summary refs log tree commit diff stats
path: root/testament
diff options
context:
space:
mode:
authorTimothee Cour <timothee.cour2@gmail.com>2021-04-23 05:36:38 -0700
committerGitHub <noreply@github.com>2021-04-23 14:36:38 +0200
commit2abc936d511342265d2ef27c4b079dd49332d65a (patch)
tree9c6b945447a8a2b31c9c752e92f8984cb630f3ae /testament
parent3516f57e172cef22f583f43c7b16fd1f63921c6e (diff)
downloadNim-2abc936d511342265d2ef27c4b079dd49332d65a.tar.gz
`typeof(voidStmt)` now works (#17807)
* `typeof(voidStmt)` now works
* remove typeOrVoid
* add condsyms, and reference cligen https://github.com/c-blake/cligen/pull/193
* fixup
* changelog [skip ci]
* fixup
Diffstat (limited to 'testament')
-rw-r--r--testament/lib/stdtest/testutils.nim11
1 files changed, 5 insertions, 6 deletions
diff --git a/testament/lib/stdtest/testutils.nim b/testament/lib/stdtest/testutils.nim
index 44048adbd..241ab1770 100644
--- a/testament/lib/stdtest/testutils.nim
+++ b/testament/lib/stdtest/testutils.nim
@@ -91,10 +91,6 @@ template disableVm*(body) =
   when nimvm: discard
   else: body
 
-template typeOrVoid[T](a: T): type =
-  # FACTOR with asyncjs.typeOrVoid
-  T
-
 macro assertAll*(body) =
   ## works in VM, unlike `check`, `require`
   runnableExamples:
@@ -106,6 +102,9 @@ macro assertAll*(body) =
   result = newStmtList()
   for a in body:
     result.add genAst(a) do:
-      # better than: `when not compiles(typeof(a)):`
-      when typeOrVoid(a) is void: a
+      # D20210421T014713:here
+      # xxx pending https://github.com/nim-lang/Nim/issues/12030,
+      # `typeof` should introduce its own scope, so that this
+      # is sufficient: `typeof(a)` instead of `typeof(block: a)`
+      when typeof(block: a) is void: a
       else: doAssert a