tprochelpers.nim 455 B

1234567891011121314151617181920212223
  1. import std/macros
  2. import stdtest/testutils
  3. macro test1(prc: untyped): untyped =
  4. assertAll:
  5. prc.params.len == 2
  6. prc.params[1].len == 4
  7. prc.pragma.len == 2
  8. prc.params = nnkFormalParams.newTree(
  9. ident("int")
  10. )
  11. prc.pragma = newEmptyNode()
  12. assertAll:
  13. prc.params.len == 1
  14. prc.pragma.len == 0
  15. prc
  16. proc test(a, b: int): int {.gcsafe, raises: [], test1.} = 5
  17. type hello = proc(a, b: int): int {.gcsafe, raises: [], test1.}