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

Function TestBoolVar

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

Source from the content-addressed store, hash-verified

73}
74
75func TestBoolVar(t *testing.T) {
76 var result bool
77 BoolVar(&result, "nonexistent", true)
78 Parse()
79
80 if result != true {
81 t.Fatalf("expected result=true, got result=%t", result)
82 }
83
84 err := os.Setenv("bool-key", "true")
85 if err != nil {
86 t.Fatal("unexpected error", err)
87 }
88
89 BoolVar(&result, "bool-key", false)
90 Parse()
91
92 if result != true {
93 t.Fatalf("expected result=true, got result=%t", true)
94 }
95}
96
97func TestDuration(t *testing.T) {
98 result := Duration("nonexistent", 15*time.Second)

Callers

nothing calls this directly

Calls 2

BoolVarFunction · 0.85
ParseFunction · 0.70

Tested by

no test coverage detected