tquasiquote.nim 288 B

123456789101112131415
  1. discard """
  2. outputsub: '''tquasiquote.nim(14, 8): Check failed: 1 > 2'''
  3. """
  4. import macros
  5. macro check(ex: untyped): untyped =
  6. var info = ex.lineInfo
  7. var expString = ex.toStrLit
  8. result = quote do:
  9. if not `ex`:
  10. echo `info`, ": Check failed: ", `expString`
  11. check 1 > 2