summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2014-01-20 20:07:44 +0100
committerAraq <rumpf_a@web.de>2014-01-20 20:07:44 +0100
commit4a0aadef4d1eef2920bd84cbc532b607741a239a (patch)
tree0202cba6e947e3afb66d4093de0c71214d625c0c /tests
parentd18f40b4e2ea594d10c654616b95b038f808b8ed (diff)
downloadNim-4a0aadef4d1eef2920bd84cbc532b607741a239a.tar.gz
parser support anon iterators
Diffstat (limited to 'tests')
-rw-r--r--tests/macros/tmemit.nim7
-rw-r--r--tests/parser/tdomulttest.nim17
-rw-r--r--tests/parser/tinvwhen.nim15
-rw-r--r--tests/pragmas/tuserpragma.nim (renamed from tests/pragma/tuserpragma.nim)0
4 files changed, 39 insertions, 0 deletions
diff --git a/tests/macros/tmemit.nim b/tests/macros/tmemit.nim
new file mode 100644
index 000000000..e4bb2daed
--- /dev/null
+++ b/tests/macros/tmemit.nim
@@ -0,0 +1,7 @@
+discard """
+  out: '''HELLO WORLD'''
+"""
+
+import macros, strutils
+
+emit("echo " & '"' & "hello world".toUpper & '"')
diff --git a/tests/parser/tdomulttest.nim b/tests/parser/tdomulttest.nim
new file mode 100644
index 000000000..4ee6de128
--- /dev/null
+++ b/tests/parser/tdomulttest.nim
@@ -0,0 +1,17 @@
+discard """
+  file: "tdomulttest.nim"
+  output: "555\ntest\nmulti lines\n99999999\nend"
+  disabled: true
+"""
+proc foo(bar, baz: proc (x: int): int) =
+  echo bar(555)
+  echo baz(99999999)
+
+foo do (x: int) -> int:
+  return x
+do (x: int) -> int:
+  echo("test")
+  echo("multi lines")
+  return x
+
+echo("end")
\ No newline at end of file
diff --git a/tests/parser/tinvwhen.nim b/tests/parser/tinvwhen.nim
new file mode 100644
index 000000000..5ff94cc6c
--- /dev/null
+++ b/tests/parser/tinvwhen.nim
@@ -0,0 +1,15 @@
+discard """
+  file: "tinvwhen.nim"
+  line: 11
+  errormsg: "invalid indentation"
+"""
+# This was parsed even though it should not!

+

+proc chdir(path: cstring): cint {.importc: "chdir", header: "dirHeader".}

+

+proc getcwd(buf: cstring, buflen: cint): cstring

+    when defined(unix): {.importc: "getcwd", header: "<unistd.h>".} #ERROR_MSG invalid indentation

+    elif defined(windows): {.importc: "getcwd", header: "<direct.h>"}

+    else: {.error: "os library not ported to your OS. Please help!".}

+
+
diff --git a/tests/pragma/tuserpragma.nim b/tests/pragmas/tuserpragma.nim
index 784baa176..784baa176 100644
--- a/tests/pragma/tuserpragma.nim
+++ b/tests/pragmas/tuserpragma.nim