diff --git a/tools/cmd/fgen/main.go b/tools/cmd/fgen/main.go index 5713c7f..0d85cb2 100644 --- a/tools/cmd/fgen/main.go +++ b/tools/cmd/fgen/main.go @@ -46,6 +46,7 @@ func main() { feature_dir := filepath.Join("features", config.Name) view_dir := filepath.Join("views", config.Name) + tests_dir := filepath.Join("tests", config.Name) err := os.MkdirAll(feature_dir, 0755) if err != nil { panic(err) } @@ -53,6 +54,9 @@ func main() { err = os.MkdirAll(view_dir, 0755) if err != nil { panic(err) } + err = os.MkdirAll(tests_dir, 0755) + if err != nil { panic(err) } + err = fs.WalkDir(templates, "templates", func(path string, d fs.DirEntry, err error) error { if err != nil { return err } @@ -68,6 +72,10 @@ func main() { out_path := filepath.Join("features", config.Name, target) err := WriteTemplate(config, path, out_path) if err != nil { panic(err) } + case strings.HasPrefix(path, "templates/tests"): + out_path := filepath.Join("tests", config.Name, target) + err := WriteTemplate(config, path, out_path) + if err != nil { panic(err) } } } diff --git a/tools/cmd/fgen/templates/tests/example_test.go b/tools/cmd/fgen/templates/tests/example_test.go new file mode 100644 index 0000000..f7318b7 --- /dev/null +++ b/tools/cmd/fgen/templates/tests/example_test.go @@ -0,0 +1,14 @@ +package tests + +import ( + "testing" + "github.com/stretchr/testify/require" +) + +func TestLogin(t *testing.T) { + assert.Equal(true, false) +} + +func TestMain(m *testing.M) { + m.Run() +}