-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhandler_simple_test.go
More file actions
39 lines (35 loc) · 871 Bytes
/
handler_simple_test.go
File metadata and controls
39 lines (35 loc) · 871 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
package interpol
import (
"testing"
)
func TestCopy(t *testing.T) {
helperTestSingle(t, []testdataSingle{
{"copy counter", "{{counter, min=0, max=2 name=cnt}}-{{copy from=cnt}}",
[]string{"0-0", "1-1", "2-2"}},
})
}
func TestCopyCorner(t *testing.T) {
ip := New()
_, err := ip.Add("{{copy from=doesnexist}}")
if err == nil {
t.Errorf("copy target doesnt exist")
}
}
func TestText(t *testing.T) {
helperTestSingle(t, []testdataSingle{
{"text", "sometext",
[]string{"sometext"}},
{"text+counter", "before{{counter, min=0, max=2 name=cnt}}after",
[]string{"before0after", "before1after", "before2after"}},
})
h1, err := newTextHandler(nil, "text", nil)
if err != nil {
t.Errorf("text handler internal error")
}
if h1.String() != "text" {
t.Errorf("text handler data error")
}
if h1.Next() {
t.Errorf("text handler next error")
}
}