refactor - tests

This commit is contained in:
Jaremy Creechley 2023-09-27 19:58:42 -07:00
parent fb73d6b5a4
commit 1ef4825c32
No known key found for this signature in database
GPG Key ID: 4E66FB67B21D3300
2 changed files with 1 additions and 12 deletions

View File

@ -213,13 +213,9 @@ iterator iter*[K, V](handle: var DbQueryHandle[K, V, FsQueryEnv[K,V]]
): ?!DbQueryResponse[K, V] =
let root = $(handle.env.self.root)
let basePath = $(handle.env.basePath)
echo "FS:root: ", root
echo "FS:basePath: ", basePath
for path in basePath.dirIter():
echo "FS:path: ", path
if handle.cancel:
# echo "FS:CANCELLED!"
break
var
@ -233,7 +229,6 @@ iterator iter*[K, V](handle: var DbQueryHandle[K, V, FsQueryEnv[K,V]]
let
flres = (basePath / path).absolutePath().catch
if flres.isErr():
# echo "FS:ERROR: ", flres.error()
yield DbQueryResponse[K,V].failure flres.error()
continue
@ -243,14 +238,12 @@ iterator iter*[K, V](handle: var DbQueryHandle[K, V, FsQueryEnv[K,V]]
if handle.query.value:
let res = readFile[V](handle.env.self, flres.get)
if res.isErr():
# echo "FS:ERROR: ", res.error()
yield DbQueryResponse[K,V].failure res.error()
continue
res.get()
else:
V.new()
# echo "FS:SUCCESS: ", key
yield success (key.some, data)
handle.close()

View File

@ -160,11 +160,7 @@ template queryTests*(
var
handle = ds.query(q).tryGet
let
res = handle.iter().toSeq().mapIt(block:
echo "\nRES: ", it.repr
# quit(1)
it.tryGet()
)
res = handle.iter().toSeq().mapIt(it.tryGet())
# ).filterIt(it.isOk).mapIt(it.tryGet())
check: