MCPcopy Create free account
hub / github.com/flant/shell-operator / TestRecursiveGetExecutablePaths

Function TestRecursiveGetExecutablePaths

pkg/utils/file/file_test.go:60–99  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

58}
59
60func TestRecursiveGetExecutablePaths(t *testing.T) {
61 dir, err := prepareTestDirTree()
62 if err != nil {
63 t.Fatalf("error creating temp directory: %v\n", err)
64 }
65 type args struct {
66 dir string
67 }
68 tests := []struct {
69 name string
70 args args
71 want []string
72 wantErr bool
73 }{
74 {
75 name: "get executable files",
76 args: args{
77 dir: dir,
78 },
79 want: []string{"aa/exec.py", "check.py"},
80 wantErr: false,
81 },
82 }
83 for _, tt := range tests {
84 t.Run(tt.name, func(t *testing.T) {
85 got, err := RecursiveGetExecutablePaths(tt.args.dir)
86 if (err != nil) != tt.wantErr {
87 t.Errorf("RecursiveGetExecutablePaths() error = %v, wantErr %v", err, tt.wantErr)
88 return
89 }
90 for i := range got {
91 if !strings.HasSuffix(got[i], tt.want[i]) {
92 t.Errorf("RecursiveGetExecutablePaths() got = %v, want %v", got, tt.want)
93 }
94 }
95 })
96 }
97
98 os.RemoveAll(dir)
99}
100
101func TestRecursiveCheckLibDirectory(t *testing.T) {
102 dir, err := prepareTestDirTree()

Callers

nothing calls this directly

Calls 3

prepareTestDirTreeFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected