Example #1
0
File: env_test.go Project: TV4/env
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)
	}
}
Example #2
0
File: env_test.go Project: TV4/env
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)
	}
}
Example #3
0
File: env_test.go Project: TV4/env
func ExampleInt() {
	os.Setenv("INT", "345")

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