dom/bindings/parser/tests/test_union_nullable.py

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/bindings/parser/tests/test_union_nullable.py	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,53 @@
     1.4 +def WebIDLTest(parser, harness):
     1.5 +    threw = False
     1.6 +    try:
     1.7 +        parser.parse("""
     1.8 +            interface OneNullableInUnion {
     1.9 +              void foo((object? or DOMString?) arg);
    1.10 +            };
    1.11 +        """)
    1.12 +
    1.13 +        results = parser.finish()
    1.14 +    except:
    1.15 +        threw = True
    1.16 +
    1.17 +    harness.ok(threw,
    1.18 +               "Two nullable member types of a union should have thrown.")
    1.19 +
    1.20 +    parser.reset()
    1.21 +    threw = False
    1.22 +
    1.23 +    try:
    1.24 +        parser.parse("""
    1.25 +            interface NullableInNullableUnion {
    1.26 +              void foo((object? or DOMString)? arg);
    1.27 +            };
    1.28 +        """)
    1.29 +
    1.30 +        results = parser.finish()
    1.31 +    except:
    1.32 +        threw = True
    1.33 +
    1.34 +    harness.ok(threw,
    1.35 +               "A nullable union type with a nullable member type should have "
    1.36 +               "thrown.")
    1.37 +
    1.38 +    parser.reset()
    1.39 +    threw = False
    1.40 +
    1.41 +    try:
    1.42 +        parser.parse("""
    1.43 +            interface NullableInUnionNullableUnionHelper {
    1.44 +            };
    1.45 +            interface NullableInUnionNullableUnion {
    1.46 +              void foo(((object? or DOMString) or NullableInUnionNullableUnionHelper)? arg);
    1.47 +            };
    1.48 +        """)
    1.49 +
    1.50 +        results = parser.finish()
    1.51 +    except:
    1.52 +        threw = True
    1.53 +
    1.54 +    harness.ok(threw,
    1.55 +               "A nullable union type with a nullable member type should have "
    1.56 +               "thrown.")

mercurial