1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/bindings/parser/tests/test_stringifier.py Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,46 @@ 1.4 +import WebIDL 1.5 + 1.6 +def WebIDLTest(parser, harness): 1.7 + parser.parse(""" 1.8 + interface TestStringifier { 1.9 + stringifier; 1.10 + }; 1.11 + """) 1.12 + 1.13 + results = parser.finish() 1.14 + 1.15 + harness.ok(isinstance(results[0].members[0], WebIDL.IDLMethod), 1.16 + "Stringifer should be method") 1.17 + 1.18 + parser = parser.reset() 1.19 + 1.20 + threw = False 1.21 + try: 1.22 + parser.parse(""" 1.23 + interface TestStringifier { 1.24 + stringifier; 1.25 + stringifier; 1.26 + }; 1.27 + """) 1.28 + results = parser.finish() 1.29 + except: 1.30 + threw = True 1.31 + 1.32 + harness.ok(threw, "Should not allow two 'stringifier;'") 1.33 + 1.34 + parser = parser.reset() 1.35 + 1.36 + threw = False 1.37 + try: 1.38 + parser.parse(""" 1.39 + interface TestStringifier { 1.40 + stringifier; 1.41 + stringifier DOMString foo(); 1.42 + }; 1.43 + """) 1.44 + results = parser.finish() 1.45 + except: 1.46 + threw = True 1.47 + 1.48 + harness.ok(threw, "Should not allow a 'stringifier;' and a 'stringifier()'") 1.49 +