From dc1b15647cfc2feea7fb41609d45910aee57573f Mon Sep 17 00:00:00 2001 From: Adam Strzelecki Date: Sun, 19 Apr 2015 17:44:04 +0200 Subject: [PATCH] Parser: Test for exact missing ':' location column This ensures compiler points to the right place when claiming that ':' is missing. --- tests/parser/tinvcolonlocation1.nim | 12 ++++++++++++ tests/parser/tinvcolonlocation2.nim | 15 +++++++++++++++ tests/parser/tinvcolonlocation3.nim | 12 ++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 tests/parser/tinvcolonlocation1.nim create mode 100644 tests/parser/tinvcolonlocation2.nim create mode 100644 tests/parser/tinvcolonlocation3.nim diff --git a/tests/parser/tinvcolonlocation1.nim b/tests/parser/tinvcolonlocation1.nim new file mode 100644 index 0000000000..cacde48bd7 --- /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 0000000000..2b6a92b9d8 --- /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 0000000000..2b30b1dbe9 --- /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"