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

Function TestFunctionEndsWith

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

Source from the content-addressed store, hash-verified

82}
83
84func TestFunctionEndsWith(t *testing.T) {
85 table := []struct {
86 input string
87 expected interface{}
88 name string
89 }{
90 {"endsWith('search', 'ch') }}", true, "endsWith-string"},
91 {"endsWith('search', 'sa') }}", false, "endsWith-string"},
92 {"endsWith('search123s', '123s') }}", true, "endsWith-string"},
93 {"endsWith(123, 's') }}", false, "endsWith-string"},
94 {"endsWith(123, '23') }}", true, "endsWith-string"},
95 {"endsWith('123', 23) }}", true, "endsWith-string"},
96 {"endsWith(null, '42') }}", false, "endsWith-string"},
97 {"endsWith('null', null) }}", true, "endsWith-string"},
98 {"endsWith('null', '') }}", true, "endsWith-string"},
99 }
100
101 env := &EvaluationEnvironment{}
102
103 for _, tt := range table {
104 t.Run(tt.name, func(t *testing.T) {
105 output, err := NewInterpeter(env, Config{}).Evaluate(tt.input, DefaultStatusCheckNone)
106 assert.Nil(t, err)
107
108 assert.Equal(t, tt.expected, output)
109 })
110 }
111}
112
113func TestFunctionJoin(t *testing.T) {
114 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…