michael@0: import WebIDL michael@0: michael@0: def WebIDLTest(parser, harness): michael@0: parser.parse(""" michael@0: [NoInterfaceObject] michael@0: interface TestExtendedAttr { michael@0: [Unforgeable] readonly attribute byte b; michael@0: }; michael@0: """) michael@0: michael@0: results = parser.finish() michael@0: michael@0: parser = parser.reset() michael@0: parser.parse(""" michael@0: [Pref="foo.bar",Pref=flop] michael@0: interface TestExtendedAttr { michael@0: [Pref="foo.bar"] attribute byte b; michael@0: }; michael@0: """) michael@0: michael@0: results = parser.finish() michael@0: michael@0: parser = parser.reset() michael@0: parser.parse(""" michael@0: interface TestLenientThis { michael@0: [LenientThis] attribute byte b; michael@0: }; michael@0: """) michael@0: michael@0: results = parser.finish() michael@0: harness.ok(results[0].members[0].hasLenientThis(), michael@0: "Should have a lenient this") michael@0: michael@0: parser = parser.reset() michael@0: threw = False michael@0: try: michael@0: parser.parse(""" michael@0: interface TestLenientThis2 { michael@0: [LenientThis=something] attribute byte b; michael@0: }; michael@0: """) michael@0: results = parser.finish() michael@0: except: michael@0: threw = True michael@0: michael@0: harness.ok(threw, "[LenientThis] must take no arguments") michael@0: michael@0: parser = parser.reset() michael@0: parser.parse(""" michael@0: interface TestClamp { michael@0: void testClamp([Clamp] long foo); michael@0: void testNotClamp(long foo); michael@0: }; michael@0: """) michael@0: michael@0: results = parser.finish() michael@0: # Pull out the first argument out of the arglist of the first (and michael@0: # only) signature. michael@0: harness.ok(results[0].members[0].signatures()[0][1][0].clamp, michael@0: "Should be clamped") michael@0: harness.ok(not results[0].members[1].signatures()[0][1][0].clamp, michael@0: "Should not be clamped") michael@0: michael@0: parser = parser.reset() michael@0: threw = False michael@0: try: michael@0: parser.parse(""" michael@0: interface TestClamp2 { michael@0: void testClamp([Clamp=something] long foo); michael@0: }; michael@0: """) michael@0: results = parser.finish() michael@0: except: michael@0: threw = True michael@0: michael@0: harness.ok(threw, "[Clamp] must take no arguments") michael@0: michael@0: parser = parser.reset() michael@0: parser.parse(""" michael@0: interface TestEnforceRange { michael@0: void testEnforceRange([EnforceRange] long foo); michael@0: void testNotEnforceRange(long foo); michael@0: }; michael@0: """) michael@0: michael@0: results = parser.finish() michael@0: # Pull out the first argument out of the arglist of the first (and michael@0: # only) signature. michael@0: harness.ok(results[0].members[0].signatures()[0][1][0].enforceRange, michael@0: "Should be enforceRange") michael@0: harness.ok(not results[0].members[1].signatures()[0][1][0].enforceRange, michael@0: "Should not be enforceRange") michael@0: michael@0: parser = parser.reset() michael@0: threw = False michael@0: try: michael@0: parser.parse(""" michael@0: interface TestEnforceRange2 { michael@0: void testEnforceRange([EnforceRange=something] long foo); michael@0: }; michael@0: """) michael@0: results = parser.finish() michael@0: except: michael@0: threw = True michael@0: michael@0: harness.ok(threw, "[EnforceRange] must take no arguments") michael@0: