4 def WebIDLTest(parser
, harness
):
7 interface TestBuiltins {
12 attribute unsigned short u16;
14 attribute unsigned long u32;
15 attribute long long s64;
16 attribute unsigned long long u64;
21 results
= parser
.finish()
23 harness
.ok(True, "TestBuiltins interface parsed without error.")
24 harness
.check(len(results
), 1, "Should be one production")
25 harness
.ok(isinstance(results
[0], WebIDL
.IDLInterface
), "Should be an IDLInterface")
28 iface
.identifier
.QName(), "::TestBuiltins", "Interface has the right QName"
30 harness
.check(iface
.identifier
.name
, "TestBuiltins", "Interface has the right name")
31 harness
.check(iface
.parent
, None, "Interface has no parent")
33 members
= iface
.members
34 harness
.check(len(members
), 9, "Should be one production")
36 names
= ["b", "s8", "u8", "s16", "u16", "s32", "u32", "s64", "u64", "ts"]
51 harness
.ok(isinstance(attr
, WebIDL
.IDLAttribute
), "Should be an IDLAttribute")
53 attr
.identifier
.QName(),
54 "::TestBuiltins::" + names
[i
],
55 "Attr has correct QName",
57 harness
.check(attr
.identifier
.name
, names
[i
], "Attr has correct name")
58 harness
.check(str(attr
.type), types
[i
], "Attr type is the correct name")
59 harness
.ok(attr
.type.isPrimitive(), "Should be a primitive type")