-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsym_test.go
53 lines (46 loc) · 1020 Bytes
/
sym_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
44
45
46
47
48
49
50
51
52
53
// Copyright 2015 Seth Bunce. All rights reserved. Use of this source code is
// governed by a BSD-style license that can be found in the LICENSE file.
package stem
import (
"testing"
)
func TestArray(t *testing.T) {
st := newsymtab(map[string]interface{}{
"a": []interface{}{},
})
if !st.Array("a").IsValid() {
t.Fatal("invalid array")
}
}
func TestIfdef(t *testing.T) {
st := newsymtab(map[string]interface{}{
"a": "b",
})
if !st.Ifdef("a") {
t.Fatal("ifdef test failed")
}
}
func TestIfndef(t *testing.T) {
st := newsymtab(map[string]interface{}{
"a": "b",
})
if st.Ifndef("a") {
t.Fatal("ifndef test failed")
}
}
func TestObject(t *testing.T) {
st := newsymtab(map[string]interface{}{
"a": map[string]interface{}{},
})
if !st.Object("a").IsValid() {
t.Fatal("'a' is not a valid object")
}
}
func TestPrint(t *testing.T) {
st := newsymtab(map[string]interface{}{
"a": "b",
})
if got, want := st.Print("a"), "b"; got != want {
t.Fatalf("got %v, want %v", got, want)
}
}