dom/bindings/parser/tests/test_mozmap.py

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 import WebIDL
     3 def WebIDLTest(parser, harness):
     4     parser.parse("""
     5         dictionary Dict {};
     6         interface MozMapArg {
     7           void foo(MozMap<Dict> arg);
     8         };
     9     """)
    11     results = parser.finish()
    13     harness.check(len(results), 2, "Should know about two things");
    14     harness.ok(isinstance(results[1], WebIDL.IDLInterface),
    15                "Should have an interface here");
    16     members = results[1].members
    17     harness.check(len(members), 1, "Should have one member")
    18     harness.ok(members[0].isMethod(), "Should have method")
    19     signature = members[0].signatures()[0]
    20     args = signature[1]
    21     harness.check(len(args), 1, "Should have one arg")
    22     harness.ok(args[0].type.isMozMap(), "Should have a MozMap type here")
    23     harness.ok(args[0].type.inner.isDictionary(),
    24                "Should have a dictionary inner type")
    26     parser = parser.reset()
    27     threw = False
    28     try:
    29         parser.parse("""
    30             interface MozMapVoidArg {
    31               void foo(MozMap<void> arg);
    32             };
    33         """)
    35         results = parser.finish()
    36     except Exception,x:
    37         threw = True
    39     harness.ok(threw, "Should have thrown.")

mercurial