func TestIntDefault(t *testing.T) { in, out := 3, 3 os.Clearenv() if got := env.Int("INT_DEFAULT", in); got != out { t.Errorf(`Int("INT_DEFAULT", %v) = %v, want %v`, in, got, out) } }
func TestInt(t *testing.T) { in, out := 1, 2 os.Setenv("INT", strconv.Itoa(out)) if got := env.Int("INT", in); got != out { t.Errorf(`Int("INT", %v) = %v, want %v`, in, got, out) } }
func ExampleInt() { os.Setenv("INT", "345") fmt.Println(env.Int("INT", 0)) // Output: 345 }