summary refs log tree commit diff stats
path: root/tests/accept/run
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2011-01-10 21:28:48 +0100
committerAraq <rumpf_a@web.de>2011-01-10 21:28:48 +0100
commit19fbc8a55edb009e216ab8954fde906dec6b738a (patch)
treef6796114c5053c39ffa9a785a5b1682c4d903c6f /tests/accept/run
parentceb1f5e218075196cd3b7d40973249e419db8ebf (diff)
downloadNim-19fbc8a55edb009e216ab8954fde906dec6b738a.tar.gz
SPEC change: ^ is right-assoc and of highest priority
Diffstat (limited to 'tests/accept/run')
-rwxr-xr-xtests/accept/run/spec.csv1
-rw-r--r--tests/accept/run/toprprec.nim12
2 files changed, 13 insertions, 0 deletions
diff --git a/tests/accept/run/spec.csv b/tests/accept/run/spec.csv
index 075e4e67e..980301bd0 100755
--- a/tests/accept/run/spec.csv
+++ b/tests/accept/run/spec.csv
@@ -49,6 +49,7 @@ tnestprc.nim;10
 toop1.nim;34[]o 5
 topenarrayrepr.nim;5 - [1]
 topenlen.nim;7
+toprprec.nim;done
 toverflw.nim;the computation overflowed
 toverflw2.nim;Error: unhandled exception: over- or underflow [EOverflow]
 toverl2.nim;true012
diff --git a/tests/accept/run/toprprec.nim b/tests/accept/run/toprprec.nim
new file mode 100644
index 000000000..4728b2e68
--- /dev/null
+++ b/tests/accept/run/toprprec.nim
@@ -0,0 +1,12 @@
+# Test operator precedence: 
+
+assert 3+5*5-2 == 28- -26-28
+
+proc `^-` (x, y: int): int =  
+  # now right-associative!
+  result = x - y
+  
+assert 34 ^- 6 ^- 2 == 30
+assert 34 - 6 - 2 == 26
+echo "done"
+