MCPcopy Index your code
hub / github.com/chain/Core / TestStringSlice

Function TestStringSlice

env/env_test.go:206–227  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

204}
205
206func TestStringSlice(t *testing.T) {
207 result := StringSlice("empty", "hi")
208 Parse()
209
210 exp := []string{"hi"}
211 if !reflect.DeepEqual(exp, *result) {
212 t.Fatalf("expected %v, got %v", exp, *result)
213 }
214
215 err := os.Setenv("string-slice-key", "hello,world")
216 if err != nil {
217 t.Fatal("unexpected error", err)
218 }
219
220 result = StringSlice("string-slice-key", "hi")
221 Parse()
222
223 exp = []string{"hello", "world"}
224 if !reflect.DeepEqual(exp, *result) {
225 t.Fatalf("expected %v, got %v", exp, *result)
226 }
227}
228
229func TestStringSliceVar(t *testing.T) {
230 var result []string

Callers

nothing calls this directly

Calls 2

StringSliceFunction · 0.85
ParseFunction · 0.70

Tested by

no test coverage detected