mirror of https://github.com/status-im/nim-eth.git
Added a supportsClear bool to testKvStore. (#579)
Obviously this is getting ugly, but for now I just want to get something committed so that I can get back to the more urgent work.
This commit is contained in:
parent
71b148a5b0
commit
27814d5b61
|
@ -10,7 +10,7 @@ const
|
|||
value2 = [5'u8, 2, 1, 0]
|
||||
key2 = [255'u8, 255]
|
||||
|
||||
proc testKvStore*(db: KvStoreRef, supportsFind: bool) =
|
||||
proc testKvStore*(db: KvStoreRef, supportsFind: bool, supportsClear: bool) =
|
||||
check:
|
||||
db != nil
|
||||
|
||||
|
@ -45,6 +45,7 @@ proc testKvStore*(db: KvStoreRef, supportsFind: bool) =
|
|||
|
||||
not db.del(key)[] # does nothing
|
||||
|
||||
if supportsClear:
|
||||
db.put(key, value2)[] # overwrite old value
|
||||
check:
|
||||
db.contains(key)[]
|
||||
|
@ -75,4 +76,4 @@ proc testKvStore*(db: KvStoreRef, supportsFind: bool) =
|
|||
|
||||
suite "MemoryStoreRef":
|
||||
test "KvStore interface":
|
||||
testKvStore(kvStore MemStoreRef.init(), true)
|
||||
testKvStore(kvStore MemStoreRef.init(), true, true)
|
||||
|
|
|
@ -14,7 +14,7 @@ procSuite "SqStoreRef":
|
|||
let kv = db.openKvStore()
|
||||
defer: kv.get()[].close()
|
||||
|
||||
testKvStore(kvStore kv.get(), true)
|
||||
testKvStore(kvStore kv.get(), true, true)
|
||||
|
||||
test "Readonly kvstore with no table":
|
||||
let db = SqStoreRef.init("", "test", inMemory = true, readOnly = true)[]
|
||||
|
|
Loading…
Reference in New Issue