Capture interface functions and record fields correctly in parser
This commit is contained in:
parent
980d27717b
commit
d9f67033b6
3 changed files with 36 additions and 5 deletions
|
|
@ -196,6 +196,27 @@ func testParsingMissingAttributes() {
|
|||
}
|
||||
}
|
||||
|
||||
@Test("Parser captures interface-level functions")
|
||||
func testInterfaceFunctions() throws {
|
||||
let xml = """
|
||||
<?xml version="1.0"?>
|
||||
<repository xmlns="http://www.gtk.org/introspection/core/1.0">
|
||||
<namespace name="Gtk" version="4.0">
|
||||
<interface name="Buildable" c:type="GtkBuildable">
|
||||
<function name="get_id" c:identifier="gtk_buildable_get_id">
|
||||
<return-value><type name="utf8"/></return-value>
|
||||
</function>
|
||||
</interface>
|
||||
</namespace>
|
||||
</repository>
|
||||
"""
|
||||
let repo = try GIRParser().parse(xmlString: xml)
|
||||
let iface = repo.namespaces[0].interfaces[0]
|
||||
#expect(iface.functions.count == 1)
|
||||
#expect(iface.functions[0].name == "get_id")
|
||||
#expect(iface.functions[0].cIdentifier == "gtk_buildable_get_id")
|
||||
}
|
||||
|
||||
@Test("Parser rejects invalid XML")
|
||||
func testParsingError() {
|
||||
let parser = GIRParser()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue