From 3a37b2e29713023dd80ef5dc9dee112bec09f58d Mon Sep 17 00:00:00 2001 From: siddontang Date: Tue, 16 Sep 2014 08:41:38 +0800 Subject: [PATCH] update store clear test --- wal/store_test.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/wal/store_test.go b/wal/store_test.go index 45636c6..5b32f3e 100644 --- a/wal/store_test.go +++ b/wal/store_test.go @@ -134,4 +134,24 @@ func testLogs(t *testing.T, l Store) { if err := l.GetLog(5, &out); err != ErrLogNotFound { t.Fatalf("err: %v ", err) } + + if err := l.Clear(); err != nil { + t.Fatal(err) + } + + idx, err = l.FirstID() + if err != nil { + t.Fatalf("err: %v ", err) + } + if idx != 0 { + t.Fatalf("bad idx: %d", idx) + } + + idx, err = l.LastID() + if err != nil { + t.Fatalf("err: %v ", err) + } + if idx != 0 { + t.Fatalf("bad idx: %d", idx) + } }