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

Function TestFunctionJoin

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

Source from the content-addressed store, hash-verified

111}
112
113func TestFunctionJoin(t *testing.T) {
114 table := []struct {
115 input string
116 expected interface{}
117 name string
118 }{
119 {"join(fromJSON('[\"a\", \"b\"]'), ',')", "a,b", "join-arr"},
120 {"join('string', ',')", "string", "join-str"},
121 {"join(1, ',')", "1", "join-number"},
122 {"join(null, ',')", "", "join-number"},
123 {"join(fromJSON('[\"a\", \"b\", null]'), null)", "ab", "join-number"},
124 {"join(fromJSON('[\"a\", \"b\"]'))", "a,b", "join-number"},
125 {"join(fromJSON('[\"a\", \"b\", null]'), 1)", "a1b1", "join-number"},
126 }
127
128 env := &EvaluationEnvironment{}
129
130 for _, tt := range table {
131 t.Run(tt.name, func(t *testing.T) {
132 output, err := NewInterpeter(env, Config{}).Evaluate(tt.input, DefaultStatusCheckNone)
133 assert.Nil(t, err)
134
135 assert.Equal(t, tt.expected, output)
136 })
137 }
138}
139
140func TestFunctionToJSON(t *testing.T) {
141 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…