mirror of
https://github.com/mappu/miqt.git
synced 2024-12-23 09:28:36 +00:00
50 lines
791 B
Go
50 lines
791 B
Go
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")
|
|
}
|
|
|
|
}
|