dom/bindings/parser/tests/test_putForwards.py

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/bindings/parser/tests/test_putForwards.py	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,107 @@
     1.4 +def WebIDLTest(parser, harness):
     1.5 +    threw = False
     1.6 +    try:
     1.7 +        parser.parse("""
     1.8 +            interface I {
     1.9 +              [PutForwards=B] readonly attribute long A;
    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, "Should have thrown.")
    1.18 +
    1.19 +    parser = parser.reset();
    1.20 +    threw = False
    1.21 +    try:
    1.22 +        parser.parse("""
    1.23 +            interface I {
    1.24 +              [PutForwards=B] readonly attribute J A;
    1.25 +            };
    1.26 +            interface J {
    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, "Should have thrown.")
    1.35 +
    1.36 +    parser = parser.reset();
    1.37 +    threw = False
    1.38 +    try:
    1.39 +        parser.parse("""
    1.40 +            interface I {
    1.41 +              [PutForwards=B] attribute J A;
    1.42 +            };
    1.43 +            interface J {
    1.44 +              attribute long B;
    1.45 +            };
    1.46 +        """)
    1.47 +
    1.48 +        results = parser.finish()
    1.49 +    except:
    1.50 +        threw = True
    1.51 +
    1.52 +    harness.ok(threw, "Should have thrown.")
    1.53 +
    1.54 +    parser = parser.reset();
    1.55 +    threw = False
    1.56 +    try:
    1.57 +        parser.parse("""
    1.58 +            interface I {
    1.59 +              [PutForwards=B] static readonly attribute J A;
    1.60 +            };
    1.61 +            interface J {
    1.62 +              attribute long B;
    1.63 +            };
    1.64 +        """)
    1.65 +
    1.66 +        results = parser.finish()
    1.67 +    except:
    1.68 +        threw = True
    1.69 +
    1.70 +    harness.ok(threw, "Should have thrown.")
    1.71 +
    1.72 +    parser = parser.reset();
    1.73 +    threw = False
    1.74 +    try:
    1.75 +        parser.parse("""
    1.76 +            callback interface I {
    1.77 +              [PutForwards=B] readonly attribute J A;
    1.78 +            };
    1.79 +            interface J {
    1.80 +              attribute long B;
    1.81 +            };
    1.82 +        """)
    1.83 +
    1.84 +        results = parser.finish()
    1.85 +    except:
    1.86 +        threw = True
    1.87 +
    1.88 +    harness.ok(threw, "Should have thrown.")
    1.89 +
    1.90 +    parser = parser.reset();
    1.91 +    threw = False
    1.92 +    try:
    1.93 +        parser.parse("""
    1.94 +            interface I {
    1.95 +              [PutForwards=C] readonly attribute J A;
    1.96 +              [PutForwards=C] readonly attribute J B;
    1.97 +            };
    1.98 +            interface J {
    1.99 +              [PutForwards=D] readonly attribute K C;
   1.100 +            };
   1.101 +            interface K {
   1.102 +              [PutForwards=A] readonly attribute I D;
   1.103 +            };
   1.104 +        """)
   1.105 +
   1.106 +        results = parser.finish()
   1.107 +    except:
   1.108 +        threw = True
   1.109 +
   1.110 +    harness.ok(threw, "Should have thrown.")

mercurial