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

Function TestStringSliceVar

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

Source from the content-addressed store, hash-verified

227}
228
229func TestStringSliceVar(t *testing.T) {
230 var result []string
231 StringSliceVar(&result, "empty", "hi")
232 Parse()
233
234 exp := []string{"hi"}
235 if !reflect.DeepEqual(exp, result) {
236 t.Fatalf("expected %v, got %v", exp, result)
237 }
238
239 err := os.Setenv("string-slice-key", "hello,world")
240 if err != nil {
241 t.Fatal("unexpected error", err)
242 }
243
244 StringSliceVar(&result, "string-slice-key", "hi", "there")
245 Parse()
246
247 exp = []string{"hello", "world"}
248 if !reflect.DeepEqual(exp, result) {
249 t.Fatalf("expected %v, got %v", exp, result)
250 }
251}

Callers

nothing calls this directly

Calls 2

StringSliceVarFunction · 0.85
ParseFunction · 0.70

Tested by

no test coverage detected