michael@0: import WebIDL michael@0: michael@0: def WebIDLTest(parser, harness): michael@0: parser.parse(""" michael@0: dictionary Dict {}; michael@0: interface MozMapArg { michael@0: void foo(MozMap arg); michael@0: }; michael@0: """) michael@0: michael@0: results = parser.finish() michael@0: michael@0: harness.check(len(results), 2, "Should know about two things"); michael@0: harness.ok(isinstance(results[1], WebIDL.IDLInterface), michael@0: "Should have an interface here"); michael@0: members = results[1].members michael@0: harness.check(len(members), 1, "Should have one member") michael@0: harness.ok(members[0].isMethod(), "Should have method") michael@0: signature = members[0].signatures()[0] michael@0: args = signature[1] michael@0: harness.check(len(args), 1, "Should have one arg") michael@0: harness.ok(args[0].type.isMozMap(), "Should have a MozMap type here") michael@0: harness.ok(args[0].type.inner.isDictionary(), michael@0: "Should have a dictionary inner type") michael@0: michael@0: parser = parser.reset() michael@0: threw = False michael@0: try: michael@0: parser.parse(""" michael@0: interface MozMapVoidArg { michael@0: void foo(MozMap arg); michael@0: }; michael@0: """) michael@0: michael@0: results = parser.finish() michael@0: except Exception,x: michael@0: threw = True michael@0: michael@0: harness.ok(threw, "Should have thrown.")