mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-31 18:32:11 +00:00
* remove echo statements * Update tests/vm/triangle_array.nim * Update tests/vm/tyaytypedesc.nim Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com> Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
18 lines
451 B
Nim
18 lines
451 B
Nim
import macros
|
|
|
|
# test that when stmt works from within a macro
|
|
|
|
macro output(s: string, xs: varargs[untyped]): auto =
|
|
result = quote do:
|
|
when compiles(`s`):
|
|
"when - " & `s`
|
|
elif compiles(`s`):
|
|
"elif - " & `s`
|
|
# should never get here so this should not break
|
|
broken.xs
|
|
else:
|
|
"else - " & `s`
|
|
# should never get here so this should not break
|
|
more.broken.xs
|
|
|
|
doAssert output("test") == "when - test" |