Bug 1915045 Ensure decode tasks are scheduled on BufferingState::Enter() r=media...
[gecko.git] / dom / bindings / parser / tests / test_empty_sequence_default_value.py
blob4771a6b1e54bbc79957450aeebf2d22219eff268
1 import WebIDL
4 def WebIDLTest(parser, harness):
5 threw = False
6 try:
7 parser.parse(
8 """
9 interface X {
10 const sequence<long> foo = [];
12 """
15 results = parser.finish()
16 except WebIDL.WebIDLError:
17 threw = True
19 harness.ok(threw, "Constant cannot have [] as a default value")
21 parser = parser.reset()
23 parser.parse(
24 """
25 interface X {
26 undefined foo(optional sequence<long> arg = []);
28 """
30 results = parser.finish()
32 harness.ok(
33 isinstance(
34 results[0].members[0].signatures()[0][1][0].defaultValue,
35 WebIDL.IDLEmptySequenceValue,
37 "Should have IDLEmptySequenceValue as default value of argument",
40 parser = parser.reset()
42 parser.parse(
43 """
44 dictionary X {
45 sequence<long> foo = [];
47 """
49 results = parser.finish()
51 harness.ok(
52 isinstance(results[0].members[0].defaultValue, WebIDL.IDLEmptySequenceValue),
53 "Should have IDLEmptySequenceValue as default value of " "dictionary member",