From 6e7bad1f7345562e06f77a27fb357f9d06ffbf9f Mon Sep 17 00:00:00 2001 From: shiron Date: Thu, 19 Dec 2024 11:55:20 +0900 Subject: [PATCH] test: add allCmd test --- cmd/gen/all_test.go | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 cmd/gen/all_test.go diff --git a/cmd/gen/all_test.go b/cmd/gen/all_test.go new file mode 100644 index 0000000..c7691ed --- /dev/null +++ b/cmd/gen/all_test.go @@ -0,0 +1,45 @@ +package gen + +import ( + "testing" +) + +func TestAllCmd(t *testing.T) { + t.Parallel() + + configFilePath, tempDir := genTestDir(t) + + type args struct { + args []string + } + + tests := []struct { + name string + args args + }{ + { + name: "2 args", + args: args{args: []string{configFilePath, tempDir}}, + }, + { + name: "1 arg", + args: args{args: []string{configFilePath}}, + }, + { + name: "0 args", + args: args{args: []string{}}, + }, + { + name: "reversed args", + args: args{args: []string{tempDir, configFilePath}}, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + t.Parallel() + + allCmd.Run(allCmd, tt.args.args) + }) + } +}