mirror of
https://github.com/logos-storage/nim-datastore.git
synced 2026-02-25 08:03:05 +00:00
test generic
This commit is contained in:
parent
cf2cbd3e1a
commit
937e1b79e8
@ -14,17 +14,12 @@ import pkg/datastore/key
|
||||
import ../dscommontests
|
||||
import ../querycommontests
|
||||
|
||||
suite "Test Basic SQLiteDatastore":
|
||||
|
||||
let
|
||||
ds = SQLiteDatastore.new(Memory).tryGet()
|
||||
keyFull = Key.init("a:b/c/d:e").tryGet()
|
||||
key = keyFull.id()
|
||||
bytes = "some bytes".toBytes
|
||||
otherBytes = "some other bytes".toBytes
|
||||
|
||||
suiteTeardown:
|
||||
ds.close().tryGet()
|
||||
proc testBasic(
|
||||
ds: SQLiteDatastore,
|
||||
key: string,
|
||||
bytes: seq[byte],
|
||||
otherBytes: seq[byte],
|
||||
) =
|
||||
|
||||
test "put":
|
||||
ds.put(key, bytes).tryGet()
|
||||
@ -76,3 +71,16 @@ suite "Test Basic SQLiteDatastore":
|
||||
|
||||
expect(DatastoreKeyNotFound):
|
||||
discard ds.get(key).tryGet() # non existing key
|
||||
|
||||
suite "Test Basic SQLiteDatastore":
|
||||
let
|
||||
ds = SQLiteDatastore.new(Memory).tryGet()
|
||||
keyFull = Key.init("a:b/c/d:e").tryGet()
|
||||
key = keyFull.id()
|
||||
bytes = "some bytes".toBytes
|
||||
otherBytes = "some other bytes".toBytes
|
||||
|
||||
suiteTeardown:
|
||||
ds.close().tryGet()
|
||||
|
||||
testBasic(ds, key, bytes, otherBytes)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user