dom/bindings/parser/tests/test_variadic_constraints.py
author Boris Zbarsky <bzbarsky@mit.edu>
Tue, 11 Dec 2012 17:50:56 -0500
changeset 115730 7a5e83065d9f20209a702ab857662818ae50d049
parent 90773 1bdb337e3136c877e5d93b9c3ebac548bd7e4fff
child 150526 877a227c502f07a77a1600edf3285665218ae0fb
permissions -rw-r--r--
Bug 815502. Implement support for variadic arguments in WebIDL. r=peterv

def WebIDLTest(parser, harness):
    threw = False
    try:
        results = parser.parse("""
            interface VariadicConstraints1 {
              void foo(byte... arg1, byte arg2);
            };
        """)

    except:
        threw = True

    harness.ok(threw, "Should have thrown.")

    threw = False
    try:
        results = parser.parse("""
            interface VariadicConstraints2 {
              void foo(byte... arg1, optional byte arg2);
            };
        """)

    except:
        threw = True

    harness.ok(threw, "Should have thrown.")

    threw = False
    try:
        results = parser.parse("""
            interface VariadicConstraints3 {
              void foo(optional byte... arg1);
            };
        """)

    except:
        threw = True

    harness.ok(threw, "Should have thrown.")

    threw = False
    try:
        results = parser.parse("""
            interface VariadicConstraints4 {
              void foo(byte... arg1 = 0);
            };
        """)

    except:
        threw = True

    harness.ok(threw, "Should have thrown on variadic argument with default value.")