dom/bindings/parser/tests/test_error_colno.py

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/bindings/parser/tests/test_error_colno.py	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,20 @@
     1.4 +import WebIDL
     1.5 +
     1.6 +def WebIDLTest(parser, harness):
     1.7 +    # Check that error messages put the '^' in the right place.
     1.8 +
     1.9 +    threw = False
    1.10 +    input = 'interface ?'
    1.11 +    try:
    1.12 +        parser.parse(input)
    1.13 +        results = parser.finish()
    1.14 +    except WebIDL.WebIDLError, e:
    1.15 +        threw = True
    1.16 +        lines = str(e).split('\n')
    1.17 +
    1.18 +        harness.check(len(lines), 3, 'Expected number of lines in error message')
    1.19 +        harness.check(lines[1], input, 'Second line shows error')
    1.20 +        harness.check(lines[2], ' ' * (len(input) - 1) + '^',
    1.21 +                      'Correct column pointer in error message')
    1.22 +
    1.23 +    harness.ok(threw, "Should have thrown.")

mercurial