michael@0: import WebIDL michael@0: michael@0: def WebIDLTest(parser, harness): michael@0: parser.parse(""" michael@0: interface SpecialMethods { michael@0: getter long long (unsigned long index); michael@0: setter long long (unsigned long index, long long value); michael@0: creator long long (unsigned long index, long long value); michael@0: deleter long long (unsigned long index); michael@0: getter boolean (DOMString name); michael@0: setter boolean (DOMString name, boolean value); michael@0: creator boolean (DOMString name, boolean value); michael@0: deleter boolean (DOMString name); michael@0: }; michael@0: michael@0: interface SpecialMethodsCombination { michael@0: getter deleter long long (unsigned long index); michael@0: setter creator long long (unsigned long index, long long value); michael@0: getter deleter boolean (DOMString name); michael@0: setter creator boolean (DOMString name, boolean value); michael@0: }; michael@0: """) michael@0: michael@0: results = parser.finish() michael@0: michael@0: def checkMethod(method, QName, name, michael@0: static=False, getter=False, setter=False, creator=False, michael@0: deleter=False, legacycaller=False, stringifier=False): michael@0: harness.ok(isinstance(method, WebIDL.IDLMethod), michael@0: "Should be an IDLMethod") michael@0: harness.check(method.identifier.QName(), QName, "Method has the right QName") michael@0: harness.check(method.identifier.name, name, "Method has the right name") michael@0: harness.check(method.isStatic(), static, "Method has the correct static value") michael@0: harness.check(method.isGetter(), getter, "Method has the correct getter value") michael@0: harness.check(method.isSetter(), setter, "Method has the correct setter value") michael@0: harness.check(method.isCreator(), creator, "Method has the correct creator value") michael@0: harness.check(method.isDeleter(), deleter, "Method has the correct deleter value") michael@0: harness.check(method.isLegacycaller(), legacycaller, "Method has the correct legacycaller value") michael@0: harness.check(method.isStringifier(), stringifier, "Method has the correct stringifier value") michael@0: michael@0: harness.check(len(results), 2, "Expect 2 interfaces") michael@0: michael@0: iface = results[0] michael@0: harness.check(len(iface.members), 8, "Expect 8 members") michael@0: michael@0: checkMethod(iface.members[0], "::SpecialMethods::__indexedgetter", "__indexedgetter", michael@0: getter=True) michael@0: checkMethod(iface.members[1], "::SpecialMethods::__indexedsetter", "__indexedsetter", michael@0: setter=True) michael@0: checkMethod(iface.members[2], "::SpecialMethods::__indexedcreator", "__indexedcreator", michael@0: creator=True) michael@0: checkMethod(iface.members[3], "::SpecialMethods::__indexeddeleter", "__indexeddeleter", michael@0: deleter=True) michael@0: checkMethod(iface.members[4], "::SpecialMethods::__namedgetter", "__namedgetter", michael@0: getter=True) michael@0: checkMethod(iface.members[5], "::SpecialMethods::__namedsetter", "__namedsetter", michael@0: setter=True) michael@0: checkMethod(iface.members[6], "::SpecialMethods::__namedcreator", "__namedcreator", michael@0: creator=True) michael@0: checkMethod(iface.members[7], "::SpecialMethods::__nameddeleter", "__nameddeleter", michael@0: deleter=True) michael@0: michael@0: iface = results[1] michael@0: harness.check(len(iface.members), 4, "Expect 4 members") michael@0: michael@0: checkMethod(iface.members[0], "::SpecialMethodsCombination::__indexedgetterdeleter", michael@0: "__indexedgetterdeleter", getter=True, deleter=True) michael@0: checkMethod(iface.members[1], "::SpecialMethodsCombination::__indexedsettercreator", michael@0: "__indexedsettercreator", setter=True, creator=True) michael@0: checkMethod(iface.members[2], "::SpecialMethodsCombination::__namedgetterdeleter", michael@0: "__namedgetterdeleter", getter=True, deleter=True) michael@0: checkMethod(iface.members[3], "::SpecialMethodsCombination::__namedsettercreator", michael@0: "__namedsettercreator", setter=True, creator=True)