Commit 8d94d7f8 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 44cb53de
...@@ -12,9 +12,16 @@ import ( ...@@ -12,9 +12,16 @@ import (
"../../../storage/fs1" "../../../storage/fs1"
"../../../zodb" "../../../zodb"
"github.com/sergi/go-diff/diffmatchpatch"
"lab.nexedi.com/kirr/go123/exc" "lab.nexedi.com/kirr/go123/exc"
) )
func diff(a, b string) string {
dmp := diffmatchpatch.New()
diffv := dmp.DiffMain(a, b, /*checklines=*/false)
return dmp.DiffPrettyText(diffv)
}
func TestZodbDump(t *testing.T) { func TestZodbDump(t *testing.T) {
buf := bytes.Buffer{} buf := bytes.Buffer{}
fs, err := fs1.Open("../../../storage/fs1/testdata/1.fs") // XXX read-only, path? fs, err := fs1.Open("../../../storage/fs1/testdata/1.fs") // XXX read-only, path?
...@@ -29,12 +36,13 @@ func TestZodbDump(t *testing.T) { ...@@ -29,12 +36,13 @@ func TestZodbDump(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
dumpOk, err := ioutil.ReadFile("testdata/1.zdump.ok") __, err := ioutil.ReadFile("testdata/1.zdump.ok")
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
dumpOk := string(__)
if !bytes.Equal(dumpOk, buf.Bytes()) { if dumpOk != buf.String() {
t.Errorf("dump different TODO show diff") // XXX github.com/sergi/go-diff.git t.Errorf("dump different:\n%v", diff(dumpOk, buf.String()))
} }
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment