forked from clbanning/x2j
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathx2jfindPath_test.go
48 lines (39 loc) · 1.17 KB
/
x2jfindPath_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 x2j
import (
"fmt"
"testing"
)
// the basic demo/test case - a small bibliography with mixed element types
func TestPathsForKey(t *testing.T) {
fmt.Println("\nPathsForKey... doc1#author")
m, _ := DocToMap(doc1)
ss := PathsForKey(m, "author")
fmt.Println("ss:", ss)
fmt.Println("\nPathsForKey... doc1#books")
// m, _ := DocToMap(doc1)
ss = PathsForKey(m, "books")
fmt.Println("ss:", ss)
fmt.Println("\nPathsForKey...doc2#book")
m, _ = DocToMap(doc2)
ss = PathsForKey(m, "book")
fmt.Println("ss:", ss)
fmt.Println("\nPathForKeyShortest...doc2#book")
m, _ = DocToMap(doc2)
s := PathForKeyShortest(m, "book")
fmt.Println("s:", s)
}
// the basic demo/test case - a small bibliography with mixed element types
func TestPathsForTag(t *testing.T) {
fmt.Println("\nPathsForTag... doc1#author")
ss, _ := PathsForTag(doc1, "author")
fmt.Println("ss:", ss)
fmt.Println("\nPathsForTag... doc1#books")
ss, _ = PathsForTag(doc1, "books")
fmt.Println("ss:", ss)
fmt.Println("\nPathsForTag...doc2#book")
ss, _ = PathsForTag(doc2, "book")
fmt.Println("ss:", ss)
fmt.Println("\nPathForTagShortest...doc2#book")
s, _ := PathForTagShortest(doc2, "book")
fmt.Println("s:", s)
}