chore:remove folder
This commit is contained in:
@@ -1,4 +1,22 @@
|
||||
#stdout
|
||||
=== Test GenHeaderFilePath ===
|
||||
Test case: Valid files
|
||||
Input files: [test1.h test2.h]
|
||||
Output: [test1.h test2.h]
|
||||
|
||||
Test case: Mixed existing and non-existing files
|
||||
Input files: [test1.h nonexistent.h]
|
||||
Error: some files not found or inaccessible: [file not found: nonexistent.h]
|
||||
Output: [test1.h]
|
||||
|
||||
Test case: No existing files
|
||||
Input files: [nonexistent1.h nonexistent2.h]
|
||||
Error: some files not found or inaccessible: [file not found: nonexistent1.h file not found: nonexistent2.h]
|
||||
|
||||
Test case: Empty file list
|
||||
Input files: []
|
||||
Error: no valid header files
|
||||
|
||||
=== Test NewSymbolProcessor ===
|
||||
Before: No prefixes After: Prefixes: [lua_ luaL_]
|
||||
|
||||
|
||||
@@ -2,12 +2,15 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
|
||||
"github.com/goplus/llgo/chore/_xtool/llcppsymg/parse"
|
||||
)
|
||||
|
||||
func main() {
|
||||
TestGenHeaderFilePath()
|
||||
TestNewSymbolProcessor()
|
||||
TestRemovePrefix()
|
||||
TestToGoName()
|
||||
@@ -16,6 +19,64 @@ func main() {
|
||||
TestParseHeaderFile()
|
||||
}
|
||||
|
||||
func TestGenHeaderFilePath() {
|
||||
fmt.Println("=== Test GenHeaderFilePath ===")
|
||||
|
||||
tempDir := os.TempDir()
|
||||
tempFile1 := filepath.Join(tempDir, "test1.h")
|
||||
tempFile2 := filepath.Join(tempDir, "test2.h")
|
||||
os.Create(tempFile1)
|
||||
os.Create(tempFile2)
|
||||
defer os.Remove(tempFile1)
|
||||
defer os.Remove(tempFile2)
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
cflags string
|
||||
files []string
|
||||
}{
|
||||
{
|
||||
name: "Valid files",
|
||||
cflags: "-I" + tempDir,
|
||||
files: []string{"test1.h", "test2.h"},
|
||||
},
|
||||
{
|
||||
name: "Mixed existing and non-existing files",
|
||||
cflags: "-I" + tempDir,
|
||||
files: []string{"test1.h", "nonexistent.h"},
|
||||
},
|
||||
{
|
||||
name: "No existing files",
|
||||
cflags: "-I" + tempDir,
|
||||
files: []string{"nonexistent1.h", "nonexistent2.h"},
|
||||
},
|
||||
{
|
||||
name: "Empty file list",
|
||||
cflags: "-I/usr/include",
|
||||
files: []string{},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
fmt.Printf("Test case: %s\n", tc.name)
|
||||
fmt.Printf("Input files: %v\n", tc.files)
|
||||
|
||||
result, err := parse.GenHeaderFilePath(tc.cflags, tc.files)
|
||||
|
||||
if err != nil {
|
||||
fmt.Printf("Error: %v\n", err)
|
||||
}
|
||||
if result != nil {
|
||||
relativeResult := make([]string, len(result))
|
||||
for i, path := range result {
|
||||
relativeResult[i] = filepath.Base(path)
|
||||
}
|
||||
fmt.Printf("Output: %v\n", relativeResult)
|
||||
}
|
||||
fmt.Println()
|
||||
}
|
||||
}
|
||||
|
||||
func TestNewSymbolProcessor() {
|
||||
fmt.Println("=== Test NewSymbolProcessor ===")
|
||||
process := parse.NewSymbolProcessor([]string{"lua_", "luaL_"})
|
||||
|
||||
Reference in New Issue
Block a user