MCPcopy
hub / github.com/nektos/act / TestFunctionHashFiles

Function TestFunctionHashFiles

pkg/exprparser/functions_test.go:189–217  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

187}
188
189func TestFunctionHashFiles(t *testing.T) {
190 table := []struct {
191 input string
192 expected interface{}
193 name string
194 }{
195 {"hashFiles('**/non-extant-files') }}", "", "hash-non-existing-file"},
196 {"hashFiles('**/non-extant-files', '**/more-non-extant-files') }}", "", "hash-multiple-non-existing-files"},
197 {"hashFiles('./for-hashing-1.txt') }}", "66a045b452102c59d840ec097d59d9467e13a3f34f6494e539ffd32c1bb35f18", "hash-single-file"},
198 {"hashFiles('./for-hashing-*.txt') }}", "8e5935e7e13368cd9688fe8f48a0955293676a021562582c7e848dafe13fb046", "hash-multiple-files"},
199 {"hashFiles('./for-hashing-*.txt', '!./for-hashing-2.txt') }}", "66a045b452102c59d840ec097d59d9467e13a3f34f6494e539ffd32c1bb35f18", "hash-negative-pattern"},
200 {"hashFiles('./for-hashing-**') }}", "c418ba693753c84115ced0da77f876cddc662b9054f4b129b90f822597ee2f94", "hash-multiple-files-and-directories"},
201 {"hashFiles('./for-hashing-3/**') }}", "6f5696b546a7a9d6d42a449dc9a56bef244aaa826601ef27466168846139d2c2", "hash-nested-directories"},
202 {"hashFiles('./for-hashing-3/**/nested-data.txt') }}", "8ecadfb49f7f978d0a9f3a957e9c8da6cc9ab871f5203b5d9f9d1dc87d8af18c", "hash-nested-directories-2"},
203 }
204
205 env := &EvaluationEnvironment{}
206
207 for _, tt := range table {
208 t.Run(tt.name, func(t *testing.T) {
209 workdir, err := filepath.Abs("testdata")
210 assert.Nil(t, err)
211 output, err := NewInterpeter(env, Config{WorkingDir: workdir}).Evaluate(tt.input, DefaultStatusCheckNone)
212 assert.Nil(t, err)
213
214 assert.Equal(t, tt.expected, output)
215 })
216 }
217}
218
219func TestFunctionFormat(t *testing.T) {
220 table := []struct {

Callers

nothing calls this directly

Calls 2

NewInterpeterFunction · 0.85
EvaluateMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…