mirror of
https://github.com/servo/servo
synced 2026-05-11 09:26:59 +02:00
This is required to publish script_bindings, since all files used during codegen need to be there. It might also be possible to generate the bindings ahead of time and vendor them in-tree, but this seems painful to setup from a CI perspective. Since there don't seem to be any other users in-tree we can just vendor into the script-bindings directory. `ply` is licensed under the BSD 3 clause, and WebIDL under MPL-2.0, with the licenses available in our cargo package. Both tools won't end up in `servo` since they are build-time dependencies, so I believe we don't need to adjust the crate license, or configure `about.toml`. Testing: Should be covered by existing tests. We don't test if this allows vendored builds or published builds. Fixes: Partial fix for #43145 --------- Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
41 lines
1.3 KiB
Python
41 lines
1.3 KiB
Python
# -*- coding: UTF-8 -*-
|
|
|
|
import WebIDL
|
|
|
|
|
|
def WebIDLTest(parser, harness):
|
|
parser.parse(
|
|
"""
|
|
interface TestUSVString {
|
|
attribute USVString svs;
|
|
};
|
|
"""
|
|
)
|
|
|
|
results = parser.finish()
|
|
|
|
harness.check(len(results), 1, "Should be one production")
|
|
harness.ok(isinstance(results[0], WebIDL.IDLInterface), "Should be an IDLInterface")
|
|
iface = results[0]
|
|
harness.check(
|
|
iface.identifier.QName(), "::TestUSVString", "Interface has the right QName"
|
|
)
|
|
harness.check(
|
|
iface.identifier.name, "TestUSVString", "Interface has the right name"
|
|
)
|
|
harness.check(iface.parent, None, "Interface has no parent")
|
|
|
|
members = iface.members
|
|
harness.check(len(members), 1, "Should be one member")
|
|
|
|
attr = members[0]
|
|
harness.ok(isinstance(attr, WebIDL.IDLAttribute), "Should be an IDLAttribute")
|
|
harness.check(
|
|
attr.identifier.QName(), "::TestUSVString::svs", "Attr has correct QName"
|
|
)
|
|
harness.check(attr.identifier.name, "svs", "Attr has correct name")
|
|
harness.check(str(attr.type), "USVString", "Attr type is the correct name")
|
|
harness.ok(attr.type.isUSVString(), "Should be USVString type")
|
|
harness.ok(attr.type.isString(), "Should be String collective type")
|
|
harness.ok(not attr.type.isDOMString(), "Should be not be DOMString type")
|