dom/bindings/parser/tests/test_variadic_constraints.py

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     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