aboutsummaryrefslogtreecommitdiffstats
path: root/skate/zippy_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'skate/zippy_test.go')
-rw-r--r--skate/zippy_test.go69
1 files changed, 69 insertions, 0 deletions
diff --git a/skate/zippy_test.go b/skate/zippy_test.go
index 84c878f..746bca4 100644
--- a/skate/zippy_test.go
+++ b/skate/zippy_test.go
@@ -103,3 +103,72 @@ func TestUniqueMatches(t *testing.T) {
}
}
}
+
+func TestMatchedRefsExtend(t *testing.T) {
+ var cases = []struct {
+ matched []*BiblioRef
+ refs []*Ref
+ result []*BiblioRef
+ }{
+ {
+ matched: []*BiblioRef{},
+ refs: []*Ref{},
+ result: []*BiblioRef{},
+ },
+ {
+ matched: []*BiblioRef{
+ &BiblioRef{
+ RefIndex: 2,
+ RefKey: "K2",
+ },
+ },
+ refs: []*Ref{},
+ result: []*BiblioRef{
+ &BiblioRef{
+ RefIndex: 2,
+ RefKey: "K2",
+ },
+ },
+ },
+ {
+ matched: []*BiblioRef{
+ &BiblioRef{
+ SourceReleaseIdent: "pud5shsflfgrth77lmlernavjm",
+ RefIndex: 2,
+ RefKey: "K2",
+ },
+ },
+ refs: []*Ref{
+ &Ref{
+ Biblio: Biblio{
+ Title: "Title",
+ },
+ Index: 3,
+ Key: "K3",
+ },
+ },
+ result: []*BiblioRef{
+ &BiblioRef{
+ SourceReleaseIdent: "pud5shsflfgrth77lmlernavjm",
+ RefIndex: 2,
+ RefKey: "K2",
+ },
+ &BiblioRef{
+ Key: "_3",
+ RefIndex: 3,
+ RefKey: "K3",
+ MatchStatus: StatusUnmatched.Short(),
+ MatchReason: ReasonUnknown.Short(),
+ SourceYear: "0",
+ },
+ },
+ },
+ }
+ for _, c := range cases {
+ result := matchedRefsExtend(c.matched, c.refs)
+ if !reflect.DeepEqual(result, c.result) {
+ t.Logf("got %v", pretty.Diff(result, c.result))
+ t.Fatalf("got %v, want %v", result, c.result)
+ }
+ }
+}