Exemple #1
0
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)
	}
}
Exemple #2
0
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)
	}
}
Exemple #3
0
func ExampleString() {
	os.Setenv("STRING", "foo bar")

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