4 def WebIDLTest(parser
, harness
):
7 interface TestCallback {
8 attribute CallbackType? listener;
11 callback CallbackType = boolean (unsigned long arg);
15 results
= parser
.finish()
17 harness
.ok(True, "TestCallback interface parsed without error.")
18 harness
.check(len(results
), 2, "Should be two productions.")
20 harness
.ok(isinstance(iface
, WebIDL
.IDLInterface
), "Should be an IDLInterface")
22 iface
.identifier
.QName(), "::TestCallback", "Interface has the right QName"
24 harness
.check(iface
.identifier
.name
, "TestCallback", "Interface has the right name")
25 harness
.check(len(iface
.members
), 1, "Expect %s members" % 1)
27 attr
= iface
.members
[0]
28 harness
.ok(isinstance(attr
, WebIDL
.IDLAttribute
), "Should be an IDLAttribute")
29 harness
.ok(attr
.isAttr(), "Should be an attribute")
30 harness
.ok(not attr
.isMethod(), "Attr is not an method")
31 harness
.ok(not attr
.isConst(), "Attr is not a const")
33 attr
.identifier
.QName(), "::TestCallback::listener", "Attr has the right QName"
35 harness
.check(attr
.identifier
.name
, "listener", "Attr has the right name")
37 harness
.ok(not isinstance(t
, WebIDL
.IDLWrapperType
), "Attr has the right type")
38 harness
.ok(isinstance(t
, WebIDL
.IDLNullableType
), "Attr has the right type")
39 harness
.ok(t
.isCallback(), "Attr has the right type")
42 harness
.ok(not callback
.isConstructor(), "callback is not constructor")