Example #1
0
File: env_test.go Project: TV4/env
func TestStringDefault(t *testing.T) {
	in, out := "baz", "baz"

	os.Clearenv()

	if got := env.String("STRING_DEFAULT", in); got != out {
		t.Errorf(`String("STRING_DEFAULT", "%v") = %v, want %v`, in, got, out)
	}
}
Example #2
0
File: env_test.go Project: TV4/env
func TestString(t *testing.T) {
	in, out := "baz", "bar"

	os.Setenv("STRING", out)

	if got := env.String("STRING", in); got != out {
		t.Errorf(`String("STRING", "%v") = %v, want %v`, in, got, out)
	}
}
Example #3
0
File: env_test.go Project: TV4/env
func ExampleString() {
	os.Setenv("STRING", "foo bar")

	fmt.Println(env.String("STRING", ""))
	// Output: foo bar
}