aboutsummaryrefslogtreecommitdiffstats
path: root/skate/reduce_test.go
diff options
context:
space:
mode:
authorMartin Czygan <martin.czygan@gmail.com>2021-07-14 22:59:18 +0200
committerMartin Czygan <martin.czygan@gmail.com>2021-07-14 22:59:18 +0200
commite99f54c2e653f0662ba0823fa3ac4bccc475dce1 (patch)
tree7435d0c0d0a15f7709449b7252fdbc603aed6042 /skate/reduce_test.go
parent26235bca235c9785752856ab7ebbdf7bf8806be8 (diff)
downloadrefcat-e99f54c2e653f0662ba0823fa3ac4bccc475dce1.tar.gz
refcat-e99f54c2e653f0662ba0823fa3ac4bccc475dce1.zip
reduce: add test
Diffstat (limited to 'skate/reduce_test.go')
-rw-r--r--skate/reduce_test.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/skate/reduce_test.go b/skate/reduce_test.go
index ddbca08..9c134f8 100644
--- a/skate/reduce_test.go
+++ b/skate/reduce_test.go
@@ -510,3 +510,23 @@ func TestCutSep(t *testing.T) {
}
}
}
+
+func TestCleanOpenLibraryIdentifier(t *testing.T) {
+ var cases = []struct {
+ s string
+ result string
+ }{
+ {"", ""},
+ {"/books/OL31189321M", "OL31189321M"},
+ {"/b/OL31189321M", "OL31189321M"},
+ {"OL31189321M", "OL31189321M"},
+ {"OL123", "OL123"},
+ {"123", ""},
+ }
+ for _, c := range cases {
+ result := cleanOpenLibraryIdentifier(c.s)
+ if result != c.result {
+ t.Fatalf("got %v, want %v", result, c.result)
+ }
+ }
+}