dom/bindings/parser/tests/test_variadic_constraints.py

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 def WebIDLTest(parser, harness):
     2     threw = False
     3     try:
     4         parser.parse("""
     5             interface VariadicConstraints1 {
     6               void foo(byte... arg1, byte arg2);
     7             };
     8         """)
     9         results = parser.finish()
    11     except:
    12         threw = True
    14     harness.ok(threw,
    15                "Should have thrown on variadic argument followed by required "
    16                "argument.")
    18     parser = parser.reset()
    19     threw = False
    20     try:
    21         parser.parse("""
    22             interface VariadicConstraints2 {
    23               void foo(byte... arg1, optional byte arg2);
    24             };
    25         """)
    26         results = parser.finish();
    27     except:
    28         threw = True
    30     harness.ok(threw,
    31                "Should have thrown on variadic argument followed by optional "
    32                "argument.")
    34     parser = parser.reset()
    35     threw = False
    36     try:
    37         parser.parse("""
    38             interface VariadicConstraints3 {
    39               void foo(optional byte... arg1);
    40             };
    41         """)
    42         results = parser.finish()
    44     except:
    45         threw = True
    47     harness.ok(threw,
    48                "Should have thrown on variadic argument explicitly flagged as "
    49                "optional.")
    51     parser = parser.reset()
    52     threw = False
    53     try:
    54         parser.parse("""
    55             interface VariadicConstraints4 {
    56               void foo(byte... arg1 = 0);
    57             };
    58         """)
    59         results = parser.finish()
    60     except:
    61         threw = True
    63     harness.ok(threw, "Should have thrown on variadic argument with default value.")

mercurial