Beispiel #1
0
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)
	}
}
Beispiel #2
0
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)
	}
}
Beispiel #3
0
func ExampleInt() {
	os.Setenv("INT", "345")

	fmt.Println(env.Int("INT", 0))
	// Output: 345
}