aboutsummaryrefslogtreecommitdiffstats
path: root/ethdb/database_test.go
diff options
context:
space:
mode:
authorgary rong <garyrong0905@gmail.com>2017-08-11 18:41:49 +0800
committerFelix Lange <fjl@users.noreply.github.com>2017-08-11 18:41:49 +0800
commit73c5aba21fcca1bf1f78e94d88920fde6762be9e (patch)
tree551324966298ee0462ff39b378925aea3597eccb /ethdb/database_test.go
parent17ce0a37de5a2712a8bf9d58df705e718b3b2cd6 (diff)
downloaddexon-73c5aba21fcca1bf1f78e94d88920fde6762be9e.tar.gz
dexon-73c5aba21fcca1bf1f78e94d88920fde6762be9e.tar.zst
dexon-73c5aba21fcca1bf1f78e94d88920fde6762be9e.zip
ethdb: return copied value from MemDatabase.Get (#14958)
Diffstat (limited to 'ethdb/database_test.go')
-rw-r--r--ethdb/database_test.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/ethdb/database_test.go b/ethdb/database_test.go
index 4740cdaed..5e4a3ca34 100644
--- a/ethdb/database_test.go
+++ b/ethdb/database_test.go
@@ -95,6 +95,21 @@ func testPutGet(db ethdb.Database, t *testing.T) {
}
for _, v := range test_values {
+ orig, err := db.Get([]byte(v))
+ if err != nil {
+ t.Fatalf("get failed: %v", err)
+ }
+ orig[0] = byte(0xff)
+ data, err := db.Get([]byte(v))
+ if err != nil {
+ t.Fatalf("get failed: %v", err)
+ }
+ if !bytes.Equal(data, []byte("?")) {
+ t.Fatalf("get returned wrong result, got %q expected ?", string(data))
+ }
+ }
+
+ for _, v := range test_values {
err := db.Delete([]byte(v))
if err != nil {
t.Fatalf("delete %q failed: %v", v, err)