Bug 1915045 Ensure decode tasks are scheduled on BufferingState::Enter() r=media...
[gecko.git] / dom / bindings / parser / tests / test_error_lineno.py
blob30629be30c05b71c799141ef59c310ee25e07c99
1 import WebIDL
4 def WebIDLTest(parser, harness):
5 # Check that error messages put the '^' in the right place.
7 threw = False
8 input = """\
9 // This is a comment.
10 interface Foo {
13 /* This is also a comment. */
14 interface ?"""
15 try:
16 parser.parse(input)
17 parser.finish()
18 except WebIDL.WebIDLError as e:
19 threw = True
20 lines = str(e).split("\n")
22 harness.check(len(lines), 3, "Expected number of lines in error message")
23 harness.ok(
24 lines[0].endswith("line 6:10"),
25 'First line of error should end with "line 6:10", but was "%s".' % lines[0],
27 harness.check(
28 lines[1],
29 "interface ?",
30 "Second line of error message is the line which caused the error.",
32 harness.check(
33 lines[2],
34 " " * (len("interface ?") - 1) + "^",
35 "Correct column pointer in error message.",
38 harness.ok(threw, "Should have thrown.")