diff options
author | Dominik Picheta <dominikpicheta@googlemail.com> | 2015-04-23 00:26:17 +0100 |
---|---|---|
committer | Dominik Picheta <dominikpicheta@googlemail.com> | 2015-04-23 00:26:17 +0100 |
commit | 9e69e4e078466886565565d6763b1e4794ea0670 (patch) | |
tree | 2d9adb4a13d6c8f132fa8592092a46da70601c33 /tests/parser | |
parent | 13a5ecda320ada29f19432df805dfc4538f8e103 (diff) | |
parent | 3b00d9cc7a06fd7720d56548b7139b8c52be5f33 (diff) | |
download | Nim-9e69e4e078466886565565d6763b1e4794ea0670.tar.gz |
Merge branch 'devel' into underscore-tuple-unpack
Conflicts: compiler/semstmts.nim
Diffstat (limited to 'tests/parser')
-rw-r--r-- | tests/parser/tstrongspaces.nim | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/tests/parser/tstrongspaces.nim b/tests/parser/tstrongspaces.nim index 91506daf0..e70b91988 100644 --- a/tests/parser/tstrongspaces.nim +++ b/tests/parser/tstrongspaces.nim @@ -2,6 +2,12 @@ discard """ output: '''35 +true +true +4 +true +1 +false 77 (Field0: 1, Field1: 2, Field2: 2) ha @@ -9,11 +15,26 @@ true tester args all all args +19 +-3 +false +-2 ''' """ echo 2+5 * 5 +# Keyword operators +echo 1 + 16 shl 1 == 1 + (16 shl 1) +echo 2 and 1 in {0, 30} +echo 2+2 * 2 shr 1 +echo false or 2 and 1 in {0, 30} + +proc `^`(a, b: int): int = a + b div 2 +echo 19 mod 16 ^ 4 + 2 and 1 +echo 18 mod 16 ^ 4 > 0 + +# echo $foo gotcha let foo = 77 echo $foo @@ -27,7 +48,7 @@ when true: let b = 66 let c = 90 let bar = 8000 - if foo+4 * 4 == 8 and b&c | 9 ++ + if foo+4 * 4 == 8 and b&c | 9 ++ bar: echo "ho" else: @@ -50,3 +71,13 @@ const echo tester & " " & args|"all" echo "all" | tester & " " & args echo "all"|tester & " " & args + +# Test arrow like operators. See also tests/macros/tclosuremacro.nim +proc `+->`(a, b: int): int = a + b*4 +template `===>`(a, b: int): expr = a - b shr 1 + +echo 3 +-> 2 + 2 and 4 +var arrowed = 3+->2 + 2 and 4 # arrowed = 4 +echo arrowed ===> 15 +echo (2 * 3+->2) == (2*3 +-> 2) +echo arrowed ===> 2 + 3+->2 |