-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsoggy_test.go
44 lines (39 loc) · 1003 Bytes
/
soggy_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
36
37
38
39
40
41
42
43
package soggy
import (
"testing"
)
func TestNewDefaultAppTrivial(t *testing.T) {
app, server := NewDefaultApp()
if app == nil {
t.Error("app is nil")
}
if server == nil {
t.Error("server is nil")
}
}
func TestNewAppTrivial(t *testing.T) {
app := NewApp()
if app == nil {
t.Error("app is nil")
}
}
func TestAddServerToApp(t *testing.T) {
app := NewApp()
if len(app.servers) != 0 {
t.Error("expected zero servers")
}
app.AddServers(NewServer("/muffin"))
if len(app.servers) != 1 {
t.Error("expected one server")
}
app.AddServers(NewServer("/longerthanmuffin"))
if (len(app.servers) != 2) {
t.Error("expected 2 servers")
}
if (app.servers[0].Mountpoint != "/longerthanmuffin/") {
t.Error("expected longest mountpoint server to be first")
}
if (app.servers[1].Mountpoint != "/muffin/") {
t.Error("expected smallest mountpoint server to be last")
}
}