Bug 1915045 Ensure decode tasks are scheduled on BufferingState::Enter() r=media...
[gecko.git] / dom / bindings / parser / tests / test_variadic_constraints.py
blob749c4a7812a25398e86f87d4d138be04d34db25e
1 import WebIDL
4 def WebIDLTest(parser, harness):
5 threw = False
6 try:
7 parser.parse(
8 """
9 interface VariadicConstraints1 {
10 undefined foo(byte... arg1, byte arg2);
12 """
14 parser.finish()
16 except WebIDL.WebIDLError:
17 threw = True
19 harness.ok(
20 threw,
21 "Should have thrown on variadic argument followed by required " "argument.",
24 parser = parser.reset()
25 threw = False
26 try:
27 parser.parse(
28 """
29 interface VariadicConstraints2 {
30 undefined foo(byte... arg1, optional byte arg2);
32 """
34 parser.finish()
35 except WebIDL.WebIDLError:
36 threw = True
38 harness.ok(
39 threw,
40 "Should have thrown on variadic argument followed by optional " "argument.",
43 parser = parser.reset()
44 threw = False
45 try:
46 parser.parse(
47 """
48 interface VariadicConstraints3 {
49 undefined foo(optional byte... arg1);
51 """
53 parser.finish()
55 except WebIDL.WebIDLError:
56 threw = True
58 harness.ok(
59 threw,
60 "Should have thrown on variadic argument explicitly flagged as " "optional.",
63 parser = parser.reset()
64 threw = False
65 try:
66 parser.parse(
67 """
68 interface VariadicConstraints4 {
69 undefined foo(byte... arg1 = 0);
71 """
73 parser.finish()
74 except WebIDL.WebIDLError:
75 threw = True
77 harness.ok(threw, "Should have thrown on variadic argument with default value.")