aboutsummaryrefslogtreecommitdiffstats
path: root/skate
diff options
context:
space:
mode:
Diffstat (limited to 'skate')
-rw-r--r--skate/zippy.go6
-rw-r--r--skate/zippy_test.go20
2 files changed, 25 insertions, 1 deletions
diff --git a/skate/zippy.go b/skate/zippy.go
index 1dbf6aa..c949069 100644
--- a/skate/zippy.go
+++ b/skate/zippy.go
@@ -327,10 +327,14 @@ func ZippyBrefAugment(bref, raw io.Reader, w io.Writer) error {
// First, iterate over all matches and sort out duplicates, e.g.
// docs that have the same source and target id.
- _, err := uniqueMatches(g.G0)
+ unique, err := uniqueMatches(g.G0)
if err != nil {
return err
}
+ // We want to find all items in g.G1, which are not in unique. This
+ // is a set like operation, but we want a custom comparator.
+ log.Println(unique)
+
return nil
}
)
diff --git a/skate/zippy_test.go b/skate/zippy_test.go
index d51a459..84c878f 100644
--- a/skate/zippy_test.go
+++ b/skate/zippy_test.go
@@ -70,6 +70,26 @@ func TestUniqueMatches(t *testing.T) {
}},
err: nil,
},
+ {
+ about: "if both are exact, we just take (any) one",
+ docs: []string{`
+ {"source_release_ident": "s1",
+ "target_release_ident": "t1",
+ "match_status": "exact",
+ "match_reason": "a"}`,
+ `{"source_release_ident": "s1",
+ "target_release_ident": "t1",
+ "match_status": "exact",
+ "match_reason": "b"}`,
+ },
+ result: []*BiblioRef{&BiblioRef{
+ SourceReleaseIdent: "s1",
+ TargetReleaseIdent: "t1",
+ MatchStatus: "exact",
+ MatchReason: "b",
+ }},
+ err: nil,
+ },
}
for _, c := range cases {
result, err := uniqueMatches(c.docs)