4 def WebIDLTest(parser
, harness
):
7 namespace MyNamespace {
14 results
= parser
.finish()
15 harness
.check(len(results
), 1, "Should have a thing.")
16 harness
.ok(results
[0].isNamespace(), "Our thing should be a namespace")
17 harness
.check(len(results
[0].members
), 2, "Should have two things in our namespace")
18 harness
.ok(results
[0].members
[0].isAttr(), "First member is attribute")
19 harness
.ok(results
[0].members
[0].isStatic(), "Attribute should be static")
20 harness
.ok(results
[0].members
[1].isMethod(), "Second member is method")
21 harness
.ok(results
[0].members
[1].isStatic(), "Operation should be static")
23 parser
= parser
.reset()
26 namespace MyNamespace {
29 partial namespace MyNamespace {
35 results
= parser
.finish()
36 harness
.check(len(results
), 2, "Should have things.")
37 harness
.ok(results
[0].isNamespace(), "Our thing should be a namespace")
38 harness
.check(len(results
[0].members
), 2, "Should have two things in our namespace")
39 harness
.ok(results
[0].members
[0].isAttr(), "First member is attribute")
40 harness
.ok(results
[0].members
[0].isStatic(), "Attribute should be static")
41 harness
.ok(results
[0].members
[1].isMethod(), "Second member is method")
42 harness
.ok(results
[0].members
[1].isStatic(), "Operation should be static")
44 parser
= parser
.reset()
47 partial namespace MyNamespace {
50 namespace MyNamespace {
56 results
= parser
.finish()
57 harness
.check(len(results
), 2, "Should have things.")
58 harness
.ok(results
[1].isNamespace(), "Our thing should be a namespace")
59 harness
.check(len(results
[1].members
), 2, "Should have two things in our namespace")
60 harness
.ok(results
[1].members
[0].isAttr(), "First member is attribute")
61 harness
.ok(results
[1].members
[0].isStatic(), "Attribute should be static")
62 harness
.ok(results
[1].members
[1].isMethod(), "Second member is method")
63 harness
.ok(results
[1].members
[1].isStatic(), "Operation should be static")
65 parser
= parser
.reset()
70 namespace MyNamespace {
71 static attribute any foo;
76 results
= parser
.finish()
77 except WebIDL
.WebIDLError
:
79 harness
.ok(threw
, "Should have thrown.")
81 parser
= parser
.reset()
86 namespace MyNamespace {
92 results
= parser
.finish()
93 except WebIDL
.WebIDLError
:
95 harness
.ok(threw
, "Should have thrown.")
97 parser
= parser
.reset()
102 namespace MyNamespace {
106 interface MyNamespace {
112 results
= parser
.finish()
113 except WebIDL
.WebIDLError
:
115 harness
.ok(threw
, "Should have thrown.")
117 parser
= parser
.reset()
122 interface MyNamespace {
126 namespace MyNamespace {
132 results
= parser
.finish()
133 except WebIDL
.WebIDLError
:
135 harness
.ok(threw
, "Should have thrown.")
137 parser
= parser
.reset()
142 namespace MyNamespace {
146 namespace MyNamespace {
152 results
= parser
.finish()
153 except WebIDL
.WebIDLError
:
155 harness
.ok(threw
, "Should have thrown.")
157 parser
= parser
.reset()
162 partial namespace MyNamespace {
166 interface MyNamespace {
172 results
= parser
.finish()
173 except WebIDL
.WebIDLError
:
175 harness
.ok(threw
, "Should have thrown.")
177 parser
= parser
.reset()
182 namespace MyNamespace {
186 partial interface MyNamespace {
192 results
= parser
.finish()
193 except WebIDL
.WebIDLError
:
195 harness
.ok(threw
, "Should have thrown.")
197 parser
= parser
.reset()
202 partial interface MyNamespace {
206 namespace MyNamespace {
212 results
= parser
.finish()
213 except WebIDL
.WebIDLError
:
215 harness
.ok(threw
, "Should have thrown.")
217 parser
= parser
.reset()
222 interface MyNamespace {
226 partial namespace MyNamespace {
232 results
= parser
.finish()
233 except WebIDL
.WebIDLError
:
235 harness
.ok(threw
, "Should have thrown.")