diff options
Diffstat (limited to 'tests/macros/tmacrostmt.nim')
-rw-r--r-- | tests/macros/tmacrostmt.nim | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/macros/tmacrostmt.nim b/tests/macros/tmacrostmt.nim index bf67a9fc3..56a0bf840 100644 --- a/tests/macros/tmacrostmt.nim +++ b/tests/macros/tmacrostmt.nim @@ -97,6 +97,9 @@ proc fn4(x: int): int = if x mod 2 == 0: return x + 2 else: return 0 +proc fn5(a, b: float): float = + result = - a * a / (b * b) + #------------------------------------ # bug #10807 proc fn_unsafeaddr(x: int): int = @@ -108,12 +111,14 @@ static: let fn2s = "proc fn2(x, y: float): float =\n result = (y + 2 * x) / (x - y)\n" let fn3s = "proc fn3(x, y: int): bool =\n result = ((x and 3) div 4 or x mod (y xor -1)) == 0 or not contains([1, 2], y)\n" let fn4s = "proc fn4(x: int): int =\n if x mod 2 == 0:\n return x + 2\n else:\n return 0\n" + let fn5s = "proc fn5(a, b: float): float =\n result = -a * a / (b * b)\n" let fnAddr = "proc fn_unsafeaddr(x: int): int =\n result = cast[int](unsafeAddr(x))\n" doAssert fn1.repr_to_string == fn1s doAssert fn2.repr_to_string == fn2s doAssert fn3.repr_to_string == fn3s doAssert fn4.repr_to_string == fn4s + doAssert fn5.repr_to_string == fn5s doAssert fn_unsafeaddr.repr_to_string == fnAddr #------------------------------------ |