Example #1
0
File: env_test.go Project: TV4/env
func TestURLDefault(t *testing.T) {
	in, out := &url.URL{Host: "example.com"}, &url.URL{Host: "example.com"}

	os.Clearenv()

	if got := env.URL("URL_DEFAULT", in); got.String() != out.String() {
		t.Errorf(`URL("URL_DEFAULT", "%v") = %v, want %v`, in, got, out)
	}
}
Example #2
0
File: env_test.go Project: TV4/env
func TestURL(t *testing.T) {
	in, out := &url.URL{Host: "example.com"}, &url.URL{Host: "example.com"}

	os.Setenv("URL", out.String())

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

	fmt.Println(env.URL("URL", &url.URL{Host: "fallback"}).String())
	// Output: http://example.com/foo
}