Skip to content
Snippets Groups Projects
Commit 4e83013c authored by Kieran Trezona-le Comte's avatar Kieran Trezona-le Comte
Browse files

Extra test case, and make existing tests more concise

parent acd87795
No related branches found
No related tags found
No related merge requests found
...@@ -35,24 +35,28 @@ RSpec.describe SQLint do ...@@ -35,24 +35,28 @@ RSpec.describe SQLint do
context "with a single invalid keyword" do context "with a single invalid keyword" do
let(:input) { "WIBBLE" } let(:input) { "WIBBLE" }
it "reports one error" do it "reports one error" do
expect(results.size).to eq(1) expect(results).to eq([error(1, 1, WIBBLE_ERROR)])
expect(results.first).to eq(error(1, 1, WIBBLE_ERROR)) end
end
context "with two successive invalid keywords" do
let(:input) { "WIBBLE WIBBLE" }
it "report 2 errors" do
expect(results).to eq([error(1, 1, WIBBLE_ERROR)])
end end
end end
context "with a single invalid keyword on a later line" do context "with a single invalid keyword on a later line" do
let(:input) { "SELECT 1;\nWIBBLE" } let(:input) { "SELECT 1;\nWIBBLE" }
it "reports one error" do it "reports one error" do
expect(results.size).to eq(1) expect(results).to eq([error(2, 1, WIBBLE_ERROR)])
expect(results.first).to eq(error(2, 1, WIBBLE_ERROR))
end end
end end
context "with a single error part-way through a line" do context "with a single error part-way through a line" do
let(:input) { "SELECT '" } let(:input) { "SELECT '" }
it "reports one error" do it "reports one error" do
expect(results.size).to eq(1) expect(results).to eq([error(1, 8, 'unterminated quoted string at or near "\'"')])
expect(results.first).to eq(error(1, 8, 'unterminated quoted string at or near "\'"'))
end end
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment