summary refs log tree commit diff stats
path: root/tests/parser
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2015-04-24 12:33:11 +0200
committerAndreas Rumpf <rumpf_a@web.de>2015-04-24 12:33:11 +0200
commit6a016743aa88af40d8c961dcc8f257dcbaade859 (patch)
tree743e554afcafa8ef0b83823e67b48a9612052562 /tests/parser
parent3e000f4e36fbffd349aa746128355f8230faf44c (diff)
parentdc1b15647cfc2feea7fb41609d45910aee57573f (diff)
downloadNim-6a016743aa88af40d8c961dcc8f257dcbaade859.tar.gz
Merge pull request #2566 from nanoant/parser-diagnostic-location
Parser: Fix location (line, col) for diagnostics
Diffstat (limited to 'tests/parser')
-rw-r--r--tests/parser/tinvcolonlocation1.nim12
-rw-r--r--tests/parser/tinvcolonlocation2.nim15
-rw-r--r--tests/parser/tinvcolonlocation3.nim12
3 files changed, 39 insertions, 0 deletions
diff --git a/tests/parser/tinvcolonlocation1.nim b/tests/parser/tinvcolonlocation1.nim
new file mode 100644
index 000000000..cacde48bd
--- /dev/null
+++ b/tests/parser/tinvcolonlocation1.nim
@@ -0,0 +1,12 @@
+discard """
+  file: "tinvcolonlocation1.nim"
+  line: 8
+  column: 3
+  errormsg: "':' expected"
+"""
+try #<- missing ':'
+  echo "try"
+except:
+  echo "except"
+finally:
+  echo "finally"
diff --git a/tests/parser/tinvcolonlocation2.nim b/tests/parser/tinvcolonlocation2.nim
new file mode 100644
index 000000000..2b6a92b9d
--- /dev/null
+++ b/tests/parser/tinvcolonlocation2.nim
@@ -0,0 +1,15 @@
+discard """
+  file: "tinvcolonlocation2.nim"
+  line: 11
+  column: 1
+  errormsg: "':' expected"
+"""
+try:
+  echo "try"
+except #<- missing ':'
+  echo "except"
+finally:
+#<-- error will be here above, at the beginning of finally,
+#    since compiler tries to consome echo and part of except
+#    expression
+  echo "finally"
diff --git a/tests/parser/tinvcolonlocation3.nim b/tests/parser/tinvcolonlocation3.nim
new file mode 100644
index 000000000..2b30b1dbe
--- /dev/null
+++ b/tests/parser/tinvcolonlocation3.nim
@@ -0,0 +1,12 @@
+discard """
+  file: "tinvcolonlocation3.nim"
+  line: 12
+  column: 3
+  errormsg: "':' expected"
+"""
+try:
+  echo "try"
+except:
+  echo "except"
+finally #<- missing ':'
+  echo "finally"