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) { func RunTest(testName string, testCases []string) {
for i, content := range testCases { 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, File: content,
Temp: true, Temp: true,
IsCpp: true, IsCpp: true,
}) })
}
}
func RunTestWithConfig(config *clangutils.Config) {
converter, err := parse.NewConverter(config)
if err != nil { if err != nil {
panic(err) panic(err)
} }
@@ -28,13 +34,12 @@ func RunTest(testName string, testCases []string) {
result := converter.MarshalASTFiles() result := converter.MarshalASTFiles()
str := result.Print() 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) cjson.FreeCStr(str)
result.Delete() result.Delete()
converter.Dispose() converter.Dispose()
} }
}
type GetTypeOptions struct { type GetTypeOptions struct {
TypeCode string // e.g. "char*", "char**" TypeCode string // e.g. "char*", "char**"