-
Notifications
You must be signed in to change notification settings - Fork 22
/
dater_test.go
69 lines (65 loc) · 1.19 KB
/
dater_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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package gedcom_test
import (
"testing"
"github.com/elliotchance/gedcom/v39"
"github.com/stretchr/testify/assert"
)
func TestDates(t *testing.T) {
tests := []struct {
nodes []gedcom.Node
want gedcom.DateNodes
}{
{nil, nil},
{
gedcom.Nodes{
gedcom.NewNode(gedcom.TagVersion, "foo", ""),
},
nil,
},
{
gedcom.Nodes{
gedcom.NewNameNode("foo bar",
gedcom.NewDateNode("2 Sep 1981"),
),
},
gedcom.DateNodes{
gedcom.NewDateNode("2 Sep 1981"),
},
},
{
gedcom.Nodes{
gedcom.NewNameNode("foo bar",
gedcom.NewDateNode("2 Sep 1981"),
gedcom.NewDateNode("3 Sep 1981"),
),
},
gedcom.DateNodes{
gedcom.NewDateNode("2 Sep 1981"),
gedcom.NewDateNode("3 Sep 1981"),
},
},
{
gedcom.Nodes{
gedcom.NewNameNode("foo bar"),
},
nil,
},
{
gedcom.Nodes{
gedcom.NewNameNode("foo bar",
gedcom.NewDateNode("bar baz"),
gedcom.NewDateNode("3 Sep 1981"),
),
},
[]*gedcom.DateNode{
gedcom.NewDateNode("bar baz"),
gedcom.NewDateNode("3 Sep 1981"),
},
},
}
for _, test := range tests {
t.Run("", func(t *testing.T) {
assert.Equal(t, test.want, gedcom.Dates(test.nodes...))
})
}
}