aboutsummaryrefslogtreecommitdiffstats
path: root/skate
diff options
context:
space:
mode:
authorMartin Czygan <martin.czygan@gmail.com>2021-06-10 16:53:42 +0200
committerMartin Czygan <martin.czygan@gmail.com>2021-06-10 16:53:42 +0200
commitc1cf9fed6be68c47331add945afe1d7e2c77428d (patch)
tree7f58907243c8b35f776e53555906db840cfca57a /skate
parent77a4e8d43c87d3582bc86696551f48cc47c688bb (diff)
downloadrefcat-c1cf9fed6be68c47331add945afe1d7e2c77428d.tar.gz
refcat-c1cf9fed6be68c47331add945afe1d7e2c77428d.zip
add case description
Diffstat (limited to 'skate')
-rw-r--r--skate/zippy_test.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/skate/zippy_test.go b/skate/zippy_test.go
index 7fd32ae..d51a459 100644
--- a/skate/zippy_test.go
+++ b/skate/zippy_test.go
@@ -31,16 +31,19 @@ func TestLineColumn(t *testing.T) {
func TestUniqueMatches(t *testing.T) {
var cases = []struct {
+ about string
docs []string
result []*BiblioRef
err error
}{
{
+ about: "missing fields are ignored",
docs: []string{`{}`},
result: []*BiblioRef{&BiblioRef{}},
err: nil,
},
{
+ about: "a single doc is passed on",
docs: []string{`{
"source_release_ident": "s1",
"target_release_ident": "t1"}`},
@@ -51,6 +54,7 @@ func TestUniqueMatches(t *testing.T) {
err: nil,
},
{
+ about: "we want to keep the exact match, if available",
docs: []string{`
{"source_release_ident": "s1",
"target_release_ident": "t1",
@@ -70,12 +74,12 @@ func TestUniqueMatches(t *testing.T) {
for _, c := range cases {
result, err := uniqueMatches(c.docs)
if err != c.err {
- t.Fatalf("got %v, want %v", err, c.err)
+ t.Fatalf("got %v, want %v (%s)", err, c.err, c.about)
}
if !reflect.DeepEqual(result, c.result) {
- t.Fatalf("got %#v, want %#v",
+ t.Fatalf("got %#v, want %#v (%s)",
pretty.Sprint(result),
- pretty.Sprint(c.result))
+ pretty.Sprint(c.result), c.about)
}
}
}