llcppsigfetch:test config

This commit is contained in:
luoliwoshang
2024-11-20 10:33:39 +08:00
parent faa9a740db
commit 97c61404ca

View File

@@ -12,11 +12,17 @@ import (
func RunTest(testName string, testCases []string) {
for i, content := range testCases {
converter, err := parse.NewConverter(&clangutils.Config{
c.Printf(c.Str("%s Case %d:\n"), c.AllocaCStr(testName), c.Int(i+1))
RunTestWithConfig(&clangutils.Config{
File: content,
Temp: true,
IsCpp: true,
})
}
}
func RunTestWithConfig(config *clangutils.Config) {
converter, err := parse.NewConverter(config)
if err != nil {
panic(err)
}
@@ -28,13 +34,12 @@ func RunTest(testName string, testCases []string) {
result := converter.MarshalASTFiles()
str := result.Print()
c.Printf(c.Str("%s Case %d:\n%s\n\n"), c.AllocaCStr(testName), c.Int(i+1), str)
c.Printf(c.Str("%s\n\n"), str)
cjson.FreeCStr(str)
result.Delete()
converter.Dispose()
}
}
type GetTypeOptions struct {
TypeCode string // e.g. "char*", "char**"