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

Function TestString

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

Source from the content-addressed store, hash-verified

161}
162
163func TestString(t *testing.T) {
164 result := String("nonexistent", "default")
165 Parse()
166
167 if *result != "default" {
168 t.Fatalf("expected result=default, got result=%s", *result)
169 }
170
171 err := os.Setenv("string-key", "something-new")
172 if err != nil {
173 t.Fatal("unexpected error", err)
174 }
175
176 result = String("string-key", "default")
177 Parse()
178
179 if *result != "something-new" {
180 t.Fatalf("expected result=something-new, got result=%s", *result)
181 }
182}
183
184func TestStringVar(t *testing.T) {
185 var result string

Callers

nothing calls this directly

Calls 2

StringFunction · 0.85
ParseFunction · 0.70

Tested by

no test coverage detected