diff options
Diffstat (limited to 'ethdb/database_test.go')
-rw-r--r-- | ethdb/database_test.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/ethdb/database_test.go b/ethdb/database_test.go index 2deb50988..74675cbe6 100644 --- a/ethdb/database_test.go +++ b/ethdb/database_test.go @@ -59,6 +59,28 @@ func TestMemoryDB_PutGet(t *testing.T) { func testPutGet(db ethdb.Database, t *testing.T) { t.Parallel() + for _, k := range test_values { + err := db.Put([]byte(k), nil) + if err != nil { + t.Fatalf("put failed: %v", err) + } + } + + for _, k := range test_values { + data, err := db.Get([]byte(k)) + if err != nil { + t.Fatalf("get failed: %v", err) + } + if len(data) != 0 { + t.Fatalf("get returned wrong result, got %q expected nil", string(data)) + } + } + + _, err := db.Get([]byte("non-exist-key")) + if err == nil { + t.Fatalf("expect to return a not found error") + } + for _, v := range test_values { err := db.Put([]byte(v), []byte(v)) if err != nil { |