texpectIdent1.nim 355 B

12345678910111213141516171819
  1. discard """
  2. errormsg: "Expected identifier to be `foo` here"
  3. line: 18
  4. """
  5. import macros
  6. macro testUntyped(arg: untyped): void =
  7. arg.expectKind nnkStmtList
  8. arg.expectLen 2
  9. arg[0].expectKind nnkCall
  10. arg[0][0].expectIdent "foo" # must pass
  11. arg[1].expectKind nnkCall
  12. arg[1][0].expectIdent "foo" # must fail
  13. testUntyped:
  14. foo(123)
  15. bar(321)