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

	os.Clearenv()

	if got := env.Bytes("BYTES_DEFAULT", in); !bytes.Equal(got, out) {
		t.Errorf(`Bytes("BYTES_DEFAULT", "%s") = %s, want %s`, in, got, out)
	}
}
Example #2
0
File: env_test.go Project: TV4/env
func TestBytes(t *testing.T) {
	in, out := []byte("baz"), []byte("bar")

	os.Setenv("BYTES", string(out))

	if got := env.Bytes("BYTES", in); !bytes.Equal(got, out) {
		t.Errorf(`Bytes("BYTES", "%s") = %s, want %s`, in, got, out)
	}
}
Example #3
0
File: env_test.go Project: TV4/env
func ExampleBytes() {
	os.Setenv("BYTES", "foo")

	fmt.Printf("%s", env.Bytes("BYTES", nil))
	// Output: foo
}