forked from noverde/pequi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main_test.go
35 lines (29 loc) · 872 Bytes
/
main_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package main
import "testing"
func TestNormalizeAddress(t *testing.T) {
exp := "http://localhost/"
addr := normalizeURLString("")
if addr != exp {
t.Errorf("Expected error \"%v\" and got \"%v\".", exp, addr)
}
exp = "http://localhost/"
addr = normalizeURLString("localhost")
if addr != exp {
t.Errorf("Expected error \"%v\" and got \"%v\".", exp, addr)
}
exp = "http://mydomain.com:8080/"
addr = normalizeURLString("mydomain.com:8080")
if addr != exp {
t.Errorf("Expected error \"%v\" and got \"%v\".", exp, addr)
}
exp = "http://mydomain.com/"
addr = normalizeURLString("http://mydomain.com")
if addr != exp {
t.Errorf("Expected error \"%v\" and got \"%v\".", exp, addr)
}
exp = "https://mydomain.com/"
addr = normalizeURLString("https://mydomain.com")
if addr != exp {
t.Errorf("Expected error \"%v\" and got \"%v\".", exp, addr)
}
}