-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathitem_test.go
48 lines (42 loc) · 903 Bytes
/
item_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
package narg
import (
"testing"
"github.com/nochso/golden"
)
func getTestItem() Item {
return Item{
Name: "key",
Args: []string{"arg1", "argument 2"},
Children: []Item{{
Name: "wait, there's more",
Children: []Item{{
Name: "foo#not-a-comment",
Args: []string{"bar", "now with \"quotes\""},
}},
}, {
Name: `!"§$%&/()=?{[]}\;:_,.-Ü*ü+ÖÄ'öä#|<>@µ`,
Children: []Item{
{Name: "1"},
{Name: "2"},
},
}},
}
}
func TestItem_String(t *testing.T) {
i := getTestItem()
actual := i.String()
tc := golden.NewCase(t, "test-fixtures/item/item.txt")
if *update {
tc.Out.Update([]byte(actual))
}
tc.Diff(actual)
}
func TestItemSlice_String(t *testing.T) {
doc := ItemSlice{getTestItem(), getTestItem()}
actual := doc.String()
tc := golden.NewCase(t, "test-fixtures/item/doc.txt")
if *update {
tc.Out.Update([]byte(actual))
}
tc.Diff(actual)
}