MCPcopy Index your code
hub / github.com/chain/Core / TestURL

Function TestURL

env/env_test.go:116–137  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

114}
115
116func TestURL(t *testing.T) {
117 example := "http://example.com"
118 newExample := "http://something-new.com"
119 result := URL("nonexistent", example)
120 Parse()
121
122 if result.String() != example {
123 t.Fatalf("expected result=%s, got result=%v", example, result)
124 }
125
126 err := os.Setenv("url-key", newExample)
127 if err != nil {
128 t.Fatal("unexpected error", err)
129 }
130
131 result = URL("url-key", example)
132 Parse()
133
134 if result.String() != newExample {
135 t.Fatalf("expected result=%v, got result=%v", newExample, result)
136 }
137}
138
139func TestURLVar(t *testing.T) {
140 example := "http://example.com"

Callers

nothing calls this directly

Calls 3

URLFunction · 0.85
ParseFunction · 0.70
StringMethod · 0.65

Tested by

no test coverage detected