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

Function TestIntVar

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

Source from the content-addressed store, hash-verified

30}
31
32func TestIntVar(t *testing.T) {
33 var result int
34 IntVar(&result, "nonexistent", 15)
35 Parse()
36
37 if result != 15 {
38 t.Fatalf("expected result=15, got result=%d", result)
39 }
40
41 err := os.Setenv("int-key", "25")
42 if err != nil {
43 t.Fatal("unexpected error", err)
44 }
45
46 IntVar(&result, "int-key", 15)
47 Parse()
48
49 if result != 25 {
50 t.Fatalf("expected result=25, got result=%d", result)
51 }
52}
53
54func TestBool(t *testing.T) {
55 result := Bool("nonexistent", true)

Callers

nothing calls this directly

Calls 2

IntVarFunction · 0.85
ParseFunction · 0.70

Tested by

no test coverage detected