Skip to content

Commit

Permalink
TestMergeHeader
Browse files Browse the repository at this point in the history
  • Loading branch information
ddkwork committed Jun 21, 2024
1 parent 1ca032e commit 7a73e92
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions gengo/bind/sdkMerge/bind_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,12 @@ import (
"testing"
"unicode"

"github.com/stretchr/testify/assert"

"github.com/ddkwork/golibrary/stream/maps"

"github.com/ddkwork/golibrary/stream"

"github.com/can1357/gengo/clang"
"github.com/can1357/gengo/gengo"

"github.com/ddkwork/golibrary/mylog"
"github.com/ddkwork/golibrary/stream"
"github.com/ddkwork/golibrary/stream/maps"
"github.com/stretchr/testify/assert"
)

const bugfix = `
Expand All @@ -35,7 +31,11 @@ typedef struct _LIST_ENTRY {
`

func TestMergeHeader(t *testing.T) {
paths := new(maps.SliceMap[string, bool])
Headers := new(maps.SliceMap[string, bool])
Imports := new(maps.SliceMap[string, bool])
Modules := new(maps.SliceMap[string, bool])
BasicTypes := ""

g := stream.NewGeneratedFile()
filepath.Walk("../../../bin", func(path string, info fs.FileInfo, err error) error {
if strings.Contains(path, "Examples") {
Expand All @@ -46,7 +46,16 @@ func TestMergeHeader(t *testing.T) {
return err
}
if filepath.Ext(path) == ".h" {
paths.Set(path, true)
switch {
case stream.BaseName(path) == "BasicTypes":
BasicTypes = path
case strings.Contains(path, "Headers"):
Headers.Set(path, true)
case strings.Contains(path, "Imports"):
Imports.Set(path, true)
case strings.Contains(path, "Modules"):
Modules.Set(path, true)
}
}
return err
})
Expand All @@ -72,7 +81,6 @@ func TestMergeHeader(t *testing.T) {
g.P()
mylog.Trace("merge", "bugfix.h")

BasicTypes := ""
for _, s := range Modules.Keys() {
if strings.Contains(s, "BasicTypes") {
BasicTypes = s
Expand Down

0 comments on commit 7a73e92

Please sign in to comment.