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

Handle subsequent error at end of input

parent da84d5c4
Branches
No related tags found
No related merge requests found
...@@ -34,7 +34,7 @@ module SQLint ...@@ -34,7 +34,7 @@ module SQLint
lint = Lint.new(@filename, line_number, column_number, :error, e.message) lint = Lint.new(@filename, line_number, column_number, :error, e.message)
input_from_error = parse_state.input[e.location..-1] input_from_error = parse_state.input[e.location..-1]
semicolon_pos = input_from_error.index(";") semicolon_pos = input_from_error.index(";") if input_from_error
[ [
lint, lint,
if semicolon_pos if semicolon_pos
......
...@@ -62,5 +62,13 @@ RSpec.describe SQLint do ...@@ -62,5 +62,13 @@ RSpec.describe SQLint do
expect(results).to eq([error(1, 1, WIBBLE_ERROR), error(1, 9, WIBBLE_ERROR)]) expect(results).to eq([error(1, 1, WIBBLE_ERROR), error(1, 9, WIBBLE_ERROR)])
end end
end end
context "when there is a second error at the end of the file" do
let(:input) { "WIBBLE; SELECT 1 FROM" }
it "report 2 errors" do
expect(results).to eq([error(1, 1, WIBBLE_ERROR),
error(1, 21, "syntax error at end of input")])
end
end
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