diff options
author | cooldome <cdome@bk.ru> | 2019-03-13 09:23:06 +0000 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2019-03-13 10:23:06 +0100 |
commit | d8c3df268371c5d749e4c4b5fe8f5a08d593ac64 (patch) | |
tree | b2c47e604b98190ea4005ae645bd82c24f810177 /tests | |
parent | ab872be476f255ea339aa203157462e9700450a6 (diff) | |
download | Nim-d8c3df268371c5d749e4c4b5fe8f5a08d593ac64.tar.gz |
fixes #10805 (#10806)
Diffstat (limited to 'tests')
-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 b67962c86..dc936042f 100644 --- a/tests/macros/tmacrostmt.nim +++ b/tests/macros/tmacrostmt.nim @@ -92,6 +92,9 @@ proc fn2(x, y: float): float = proc fn3(x, y: int): bool = (((x and 3) div 4) or (x mod (y xor -1))) == 0 or y notin [1,2] +proc fn4(x: int): int = + if x mod 2 == 0: return x + 2 + else: return 0 #------------------------------------ # bug #10807 @@ -103,11 +106,13 @@ static: let fn1s = "proc fn1(x, y: int): int =\n result = 2 * (x + y)\n" 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 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 fn_unsafeaddr.repr_to_string == fnAddr #------------------------------------ |