activated tests for tr macros

This commit is contained in:
Araq
2012-09-06 00:23:55 +02:00
parent 30c00aba07
commit 355ae07b8f
7 changed files with 62 additions and 24 deletions

13
tests/patterns/tcse.nim Normal file
View File

@@ -0,0 +1,13 @@
discard """
output: "4"
"""
template cse{f(a, a, x)}(a: expr{(nkDotExpr|call|nkBracketExpr)&noSideEffect},
f: expr, x: varargs[expr]): expr =
let aa = a
f(aa, aa, x)+4
var
a: array[0..10, int]
i = 3
echo a[i] + a[i]

View File

@@ -0,0 +1,16 @@
discard """
output: "23"
"""
template optslice{a = b + c}(a: expr{noalias}, b, c: expr): stmt =
a = b
inc a, c
var
x = 12
y = 10
z = 13
x = y+z
echo x

View File

@@ -1,6 +1,7 @@
discard """
output: '''0
|12|34
|12|
34
'''
"""