mirror of
https://github.com/mappu/miqt.git
synced 2024-12-22 08:58:37 +00:00
genbindings/test: add test cases for child class expansion
This commit is contained in:
parent
4451a592ab
commit
cde78306c2
49
cmd/genbindings/transformchildclasses_test.go
Normal file
49
cmd/genbindings/transformchildclasses_test.go
Normal file
@ -0,0 +1,49 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestChildClassesExtract(t *testing.T) {
|
||||
|
||||
src := CppParsedHeader{
|
||||
Classes: []CppClass{
|
||||
|
||||
CppClass{
|
||||
ClassName: "Parent",
|
||||
|
||||
ChildClassdefs: []CppClass{
|
||||
|
||||
CppClass{
|
||||
ClassName: "Parent::Child",
|
||||
|
||||
ChildClassdefs: []CppClass{
|
||||
|
||||
CppClass{
|
||||
ClassName: "Parent::Child::Grandchild",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
astTransformChildClasses(&src)
|
||||
if len(src.Classes) != 3 {
|
||||
t.Fatal("expected 3 classes")
|
||||
}
|
||||
|
||||
if src.Classes[0].ClassName != "Parent" {
|
||||
t.Fatal("expected parent class name")
|
||||
}
|
||||
|
||||
if src.Classes[1].ClassName != "Parent::Child::Grandchild" {
|
||||
t.Fatal("expected grandchild class name")
|
||||
}
|
||||
|
||||
if src.Classes[2].ClassName != "Parent::Child" {
|
||||
t.Fatal("expected child class name")
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user