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

Function TestFunctionToJSON

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

Source from the content-addressed store, hash-verified

138}
139
140func TestFunctionToJSON(t *testing.T) {
141 table := []struct {
142 input string
143 expected interface{}
144 name string
145 }{
146 {"toJSON(env) }}", "{\n \"key\": \"value\"\n}", "toJSON"},
147 {"toJSON(null)", "null", "toJSON-null"},
148 }
149
150 env := &EvaluationEnvironment{
151 Env: map[string]string{
152 "key": "value",
153 },
154 }
155
156 for _, tt := range table {
157 t.Run(tt.name, func(t *testing.T) {
158 output, err := NewInterpeter(env, Config{}).Evaluate(tt.input, DefaultStatusCheckNone)
159 assert.Nil(t, err)
160
161 assert.Equal(t, tt.expected, output)
162 })
163 }
164}
165
166func TestFunctionFromJSON(t *testing.T) {
167 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…