diff options
-rw-r--r-- | skate/schema.go | 4 | ||||
-rw-r--r-- | skate/xio/util_test.go | 35 | ||||
-rw-r--r-- | skate/zippy.go | 2 |
3 files changed, 39 insertions, 2 deletions
diff --git a/skate/schema.go b/skate/schema.go index af920ee..c0be5ef 100644 --- a/skate/schema.go +++ b/skate/schema.go @@ -334,8 +334,8 @@ type BiblioRef struct { SourceWorkIdent string `json:"source_work_ident,omitempty"` SourceWikipediaArticle string `json:"source_wikipedia_article,omitempty"` SourceReleaseStage string `json:"source_release_stage,omitempty"` - SourceYear string `json:"source_year,omitempty"` - RefIndex int64 `json:"ref_index,omitempty"` // 1-based + SourceYear string `json:"source_year,omitempty"` // TODO: should this be source_release_year + RefIndex int64 `json:"ref_index,omitempty"` // 1-based RefKey string `json:"ref_key,omitempty"` RefLocator string `json:"ref_locator,omitempty"` TargetReleaseIdent string `json:"target_release_ident,omitempty"` diff --git a/skate/xio/util_test.go b/skate/xio/util_test.go new file mode 100644 index 0000000..b1e06a5 --- /dev/null +++ b/skate/xio/util_test.go @@ -0,0 +1,35 @@ +package xio + +import ( + "io/ioutil" + "testing" +) + +func TestOpenTwo(t *testing.T) { + a, err := tempFile(t) + if err != nil { + t.Fatalf("failed to create tmp file: %v", err) + } + b, err := tempFile(t) + if err != nil { + t.Fatalf("failed to create tmp file: %v", err) + } + f1, f2, err := OpenTwo(a, b) + if err != nil { + t.Fatalf("failed to OpenTwo: %v", err) + } + defer f1.Close() + defer f2.Close() +} + +// tempFile creates an empty temporary file and returns its name on success. +func tempFile(t *testing.T) (filename string, err error) { + f, err := ioutil.TempFile(t.TempDir(), "") + if err != nil { + return "", err + } + if err := f.Close(); err != nil { + return "", err + } + return f.Name(), nil +} diff --git a/skate/zippy.go b/skate/zippy.go index a846a3b..69f4473 100644 --- a/skate/zippy.go +++ b/skate/zippy.go @@ -9,6 +9,8 @@ // The most confusing aspect currently is the variety of schemas hidden within // the readers (and string groups): release, ref, ref-as-release, open library, // wikipedia, ... +// +// TODO: [ ] pass release stage through all match types package skate import ( |