Bug 1915045 Ensure decode tasks are scheduled on BufferingState::Enter() r=media...
[gecko.git] / dom / bindings / parser / tests / test_optional_constraints.py
blob34f03467621f8d053240547f86d2f1efa77a696c
1 import WebIDL
4 def WebIDLTest(parser, harness):
5 threw = False
6 try:
7 parser.parse(
8 """
9 interface OptionalConstraints1 {
10 undefined foo(optional byte arg1, byte arg2);
12 """
15 parser.finish()
16 except WebIDL.WebIDLError:
17 threw = True
19 harness.ok(
20 not threw,
21 "Should not have thrown on non-optional argument following "
22 "optional argument.",
25 parser = parser.reset()
26 parser.parse(
27 """
28 interface OptionalConstraints2 {
29 undefined foo(optional byte arg1 = 1, optional byte arg2 = 2,
30 optional byte arg3, optional byte arg4 = 4,
31 optional byte arg5, optional byte arg6 = 9);
33 """
35 results = parser.finish()
36 args = results[0].members[0].signatures()[0][1]
37 harness.check(len(args), 6, "Should have 6 arguments")
38 harness.check(args[5].defaultValue.value, 9, "Should have correct default value")