Exemplo n.º 1
0
Arquivo: env_test.go Projeto: 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)
	}
}
Exemplo n.º 2
0
Arquivo: env_test.go Projeto: 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)
	}
}
Exemplo n.º 3
0
Arquivo: env_test.go Projeto: 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
}