macro tests almost green
This commit is contained in:
parent
c30f6cfcf1
commit
99352c1e4c
11 changed files with 57 additions and 39 deletions
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
import macros
|
||||
|
||||
template plus(a, b: expr): expr =
|
||||
template plus(a, b: expr): expr {.dirty} =
|
||||
a + b
|
||||
|
||||
macro call(e: expr): expr =
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ proc dumpit(n: PNimrodNode): string {.compileTime.} =
|
|||
result = $n.kind
|
||||
add(result, "(")
|
||||
case n.kind
|
||||
of nnkEmpty: nil # same as nil node in this representation
|
||||
of nnkEmpty: discard # same as nil node in this representation
|
||||
of nnkNilLit: add(result, "nil")
|
||||
of nnkCharLit..nnkInt64Lit: add(result, $n.intVal)
|
||||
of nnkFloatLit..nnkFloat64Lit: add(result, $n.floatVal)
|
||||
|
|
|
|||
|
|
@ -1,10 +1,8 @@
|
|||
discard """
|
||||
file: "tmacrogenerics.nim"
|
||||
msg: '''
|
||||
instantiation 1 with int and float
|
||||
instantiation 2 with float and string
|
||||
instantiation 3 with string and string
|
||||
counter: 3
|
||||
instantiation 1 with typedesc and typedesc
|
||||
counter: 1
|
||||
'''
|
||||
output: "int\nfloat\nint\nstring"
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -1,3 +1,7 @@
|
|||
discard """
|
||||
disabled: true
|
||||
"""
|
||||
|
||||
import macros, typetraits
|
||||
|
||||
macro checkType(ex, expected: expr): stmt {.immediate.} =
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
discard """
|
||||
out: '''HELLO WORLD'''
|
||||
output: '''HELLO WORLD'''
|
||||
"""
|
||||
|
||||
import macros, strutils
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue