Move remove() and removeAll() to tests

This is done to keep deadcode quiet.
This commit is contained in:
kortschak 2014-08-22 16:50:39 +09:30
parent cce0f88803
commit ec008b5820
2 changed files with 19 additions and 18 deletions

View file

@ -19,6 +19,7 @@ import (
"compress/bzip2"
"compress/gzip"
"fmt"
"github.com/google/cayley/quad"
"io"
"reflect"
"sort"
@ -411,6 +412,24 @@ func deletePrepare(t testing.TB) {
})
}
func removeAll(qw graph.QuadWriter, cfg *config.Config, path, typ string) error {
return decompressAndLoad(qw, cfg, path, typ, remove)
}
func remove(qw graph.QuadWriter, cfg *config.Config, dec quad.Unmarshaler) error {
for {
t, err := dec.Unmarshal()
if err != nil {
if err == io.EOF {
break
}
return err
}
qw.RemoveQuad(t)
}
return nil
}
func TestQueries(t *testing.T) {
prepare(t)
checkQueries(t)