v0.0.294 migrate bfcodegen to templates
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 58s

This commit is contained in:
2023-10-31 22:58:28 +01:00
parent ab1a1ab6f6
commit 75f71fe3db
11 changed files with 492 additions and 377 deletions

View File

@@ -2,6 +2,7 @@ package bfcodegen
import (
_ "embed"
"fmt"
"gogs.mikescher.com/BlackForestBytes/goext/cmdext"
"gogs.mikescher.com/BlackForestBytes/goext/langext"
"gogs.mikescher.com/BlackForestBytes/goext/tst"
@@ -12,7 +13,7 @@ import (
)
//go:embed _test_example.tgz
var ExampleModels []byte
var EnumExampleModels []byte
func TestGenerateEnumSpecs(t *testing.T) {
@@ -20,7 +21,7 @@ func TestGenerateEnumSpecs(t *testing.T) {
tmpDir := filepath.Join(t.TempDir(), langext.MustHexUUID())
err := os.WriteFile(tmpFile, ExampleModels, 0o777)
err := os.WriteFile(tmpFile, EnumExampleModels, 0o777)
tst.AssertNoErr(t, err)
t.Cleanup(func() { _ = os.Remove(tmpFile) })
@@ -39,4 +40,13 @@ func TestGenerateEnumSpecs(t *testing.T) {
err = GenerateEnumSpecs(tmpDir, tmpDir+"/enums_gen.go")
tst.AssertNoErr(t, err)
fmt.Println()
fmt.Println()
fmt.Println()
fmt.Println("=====================================================================================================")
fmt.Println(string(tst.Must(os.ReadFile(tmpDir + "/enums_gen.go"))(t)))
fmt.Println("=====================================================================================================")
fmt.Println()
fmt.Println()
fmt.Println()
}