From d1fc9afec0f1bfcf8877de65667911bef1f07513 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Sun, 27 Nov 2011 13:37:59 -0500 Subject: [PATCH] index: move dump to a method Change-Id: I784bca14185db9eb255b0d6adc96adddc721cd02 --- lib/go/camli/index/index_test.go | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/lib/go/camli/index/index_test.go b/lib/go/camli/index/index_test.go index 950516077..b40e66867 100644 --- a/lib/go/camli/index/index_test.go +++ b/lib/go/camli/index/index_test.go @@ -35,6 +35,18 @@ type IndexDeps struct { SignerBlobRef *blobref.BlobRef } +func (id *IndexDeps) dumpIndex(t *testing.T) { + t.Logf("Begin index dump:") + it := id.Index.s.Find("") + for it.Next() { + t.Logf(" %q = %q", it.Key(), it.Value()) + } + if err := it.Close(); err != nil { + t.Fatalf("iterator close = %v", err) + } + t.Logf("End index dump.") +} + func (id *IndexDeps) uploadAndSignMap(m map[string]interface{}) *blobref.BlobRef { m["camliSigner"] = id.SignerBlobRef unsigned, err := schema.MapToCamliJson(m) @@ -99,13 +111,7 @@ func TestIndexPopulation(t *testing.T) { id := NewIndexDeps() pn := id.NewPermanode() t.Logf("uploaded permanode %q", pn) - it := id.Index.s.Find("") - for it.Next() { - t.Logf(" %q = %q", it.Key(), it.Value()) - } - if err := it.Close(); err != nil { - t.Fatalf("iterator close = %v", err) - } + id.dumpIndex(t) } func TestReverseTimeString(t *testing.T) {