mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
parent
5b76a3b8dd
commit
8e1a9f72dd
5 changed files with 34 additions and 5 deletions
7
tests/sample_errors/consecutive_unexpected_tokens.blp
Normal file
7
tests/sample_errors/consecutive_unexpected_tokens.blp
Normal file
|
@ -0,0 +1,7 @@
|
|||
using Gtk 4.0;
|
||||
|
||||
Button {
|
||||
visible: false;
|
||||
not actually blueprint code;
|
||||
Label {}
|
||||
}
|
1
tests/sample_errors/consecutive_unexpected_tokens.err
Normal file
1
tests/sample_errors/consecutive_unexpected_tokens.err
Normal file
|
@ -0,0 +1 @@
|
|||
5,3,31,Unexpected tokens
|
|
@ -71,9 +71,9 @@ class TestSamples(unittest.TestCase):
|
|||
raise MultipleErrors(ast.errors)
|
||||
except PrintableError as e:
|
||||
def error_str(error):
|
||||
line, col = utils.idx_to_pos(error.start, blueprint)
|
||||
line, col = utils.idx_to_pos(error.start + 1, blueprint)
|
||||
len = error.end - error.start
|
||||
return ",".join([str(line + 1), str(col + 1), str(len), error.message])
|
||||
return ",".join([str(line + 1), str(col), str(len), error.message])
|
||||
|
||||
if isinstance(e, CompileError):
|
||||
actual = error_str(e)
|
||||
|
@ -143,6 +143,7 @@ class TestSamples(unittest.TestCase):
|
|||
self.assert_sample_error("a11y_prop_type")
|
||||
self.assert_sample_error("class_assign")
|
||||
self.assert_sample_error("class_dne")
|
||||
self.assert_sample_error("consecutive_unexpected_tokens")
|
||||
self.assert_sample_error("duplicate_obj_id")
|
||||
self.assert_sample_error("enum_member_dne")
|
||||
self.assert_sample_error("filters_in_non_file_filter")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue