1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/bindings/parser/tests/test_mozmap.py Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,39 @@ 1.4 +import WebIDL 1.5 + 1.6 +def WebIDLTest(parser, harness): 1.7 + parser.parse(""" 1.8 + dictionary Dict {}; 1.9 + interface MozMapArg { 1.10 + void foo(MozMap<Dict> arg); 1.11 + }; 1.12 + """) 1.13 + 1.14 + results = parser.finish() 1.15 + 1.16 + harness.check(len(results), 2, "Should know about two things"); 1.17 + harness.ok(isinstance(results[1], WebIDL.IDLInterface), 1.18 + "Should have an interface here"); 1.19 + members = results[1].members 1.20 + harness.check(len(members), 1, "Should have one member") 1.21 + harness.ok(members[0].isMethod(), "Should have method") 1.22 + signature = members[0].signatures()[0] 1.23 + args = signature[1] 1.24 + harness.check(len(args), 1, "Should have one arg") 1.25 + harness.ok(args[0].type.isMozMap(), "Should have a MozMap type here") 1.26 + harness.ok(args[0].type.inner.isDictionary(), 1.27 + "Should have a dictionary inner type") 1.28 + 1.29 + parser = parser.reset() 1.30 + threw = False 1.31 + try: 1.32 + parser.parse(""" 1.33 + interface MozMapVoidArg { 1.34 + void foo(MozMap<void> arg); 1.35 + }; 1.36 + """) 1.37 + 1.38 + results = parser.finish() 1.39 + except Exception,x: 1.40 + threw = True 1.41 + 1.42 + harness.ok(threw, "Should have thrown.")