forked from julienschmidt/httprouter
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathnamespace_test.go
More file actions
45 lines (34 loc) · 779 Bytes
/
namespace_test.go
File metadata and controls
45 lines (34 loc) · 779 Bytes
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
44
// Copyright 2013 Julien Schmidt. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be found
// in the LICENSE file.
package httprouter
import (
"testing"
)
func TestCreateNamespace(t *testing.T) {
mockNamespace := Namespace{
Name: "/api",
IsRoot: true,
}
root := New("/api")
if root.Name != mockNamespace.Name{
t.Error("Namespace's name failed")
}
if root.IsRoot != true{
t.Error("Namespace is not root")
}
}
func TestAddNamespace(t *testing.T) {
mockNamespace := Namespace{
Name: "/api/v1",
IsRoot: false,
}
root := New("/api")
v1 := root.Use("/v1")
if v1.Name != mockNamespace.Name{
t.Error("Sub Namespace's name failed")
}
if v1.IsRoot != false{
t.Error("Namespace should not be root")
}
}