summary refs log tree commit diff stats
path: root/tests/lexer/mlexerutils.nim
blob: eae7a0006938a32e818bd7deba8f44904ddc7cd9 (plain) (blame)
1
2
3
4
5
6
7
8
9
import macros

macro lispReprStr*(a: untyped): untyped = newLit(a.lispRepr)

macro assertAST*(expected: string, struct: untyped): untyped =
  var ast = newLit(struct.treeRepr)
  result = quote do:
    if `ast` != `expected`:
      doAssert false, "\nGot:\n" & `ast`.indent(2) & "\nExpected:\n" & `expected`.indent(2)