aboutsummaryrefslogtreecommitdiffstats
path: root/skate/reduce_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'skate/reduce_test.go')
-rw-r--r--skate/reduce_test.go40
1 files changed, 40 insertions, 0 deletions
diff --git a/skate/reduce_test.go b/skate/reduce_test.go
index 172547b..65f3305 100644
--- a/skate/reduce_test.go
+++ b/skate/reduce_test.go
@@ -435,6 +435,46 @@ func TestZippyExact(t *testing.T) {
}
}
+func TestZippyBrefAugment(t *testing.T) {
+ var cases = []struct {
+ a, b, out string
+ err error
+ }{
+ {
+ a: "testdata/zippy/cB00a.json",
+ b: "testdata/zippy/cB00b.json",
+ out: "testdata/zippy/cB00r.json",
+ err: nil,
+ },
+ }
+ timeNow = func() time.Time {
+ return time.Date(1970, 1, 1, 0, 0, 0, 0, time.UTC)
+ }
+ for i, c := range cases {
+ a, b, err := xio.OpenTwo(c.a, c.b)
+ if err != nil {
+ t.Errorf("failed to open test files: %v, %v", c.a, c.b)
+ }
+ var buf bytes.Buffer
+ err = ZippyBrefAugment(a, b, &buf)
+ if err != c.err {
+ t.Errorf("[%d] got %v, want %v", i, err, c.err)
+ }
+ ok, err := testutil.BufferFileEquals(&buf, c.out)
+ if err != nil {
+ t.Errorf("failed to open test file: %v", c.out)
+ }
+ if !ok {
+ filename, err := testutil.BufferToTemp(&buf)
+ if err != nil {
+ t.Logf("could not write temp file: %v", err)
+ }
+ t.Errorf("[%d] output mismatch (buffer length=%d, content=%v), want %v",
+ i, buf.Len(), filename, c.out)
+ }
+ }
+}
+
func TestCutBatch(t *testing.T) {
var cases = []struct {
lines []string