summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2014-04-20 20:01:36 +0200
committerAraq <rumpf_a@web.de>2014-04-20 20:01:36 +0200
commit1bb0bdec246dbc9ed3bc967ca4e1e70b6fbb35bd (patch)
tree9fc3b866b525dde0f7c119d3970d947e14691c63 /tests
parente6d17e62731a05110e464854eda79e891aaf2ff5 (diff)
parent013289480d9cef6cc7f789b9c886bf02fadc1387 (diff)
downloadNim-1bb0bdec246dbc9ed3bc967ca4e1e70b6fbb35bd.tar.gz
Merge branch 'devel' of https://github.com/Araq/Nimrod into devel
Diffstat (limited to 'tests')
-rw-r--r--tests/closure/tclosuremacro.nim43
-rw-r--r--tests/testament/categories.nim2
2 files changed, 44 insertions, 1 deletions
diff --git a/tests/closure/tclosuremacro.nim b/tests/closure/tclosuremacro.nim
new file mode 100644
index 000000000..008078bbb
--- /dev/null
+++ b/tests/closure/tclosuremacro.nim
@@ -0,0 +1,43 @@
+discard """
+  output: '''10
+10
+10
+3
+3
+noReturn
+'''
+"""
+
+import future
+
+proc twoParams(x: (int, int) -> int): int =
+  result = x(5, 5)
+
+proc oneParam(x: int -> int): int =
+  x(5)
+
+proc noParams(x: () -> int): int =
+  result = x()
+
+proc noReturn(x: () -> void) =
+  x()
+
+proc doWithOneAndTwo(f: (int, int) -> int): int =
+  f(1,2)
+
+echo twoParams(proc (a, b): auto = a + b)
+echo twoParams((x, y) => x + y)
+
+echo oneParam(x => x+5) 
+
+echo noParams(() => 3)
+
+echo doWithOneAndTwo((x, y) => x + y)
+
+noReturn(() -> void => echo("noReturn"))
+
+when false:
+  proc pass2(f: (int, int) -> int): (int) -> int =
+    (x: int) -> int => f(2, x)
+
+  #echo pass2((x, y) => x + y)
diff --git a/tests/testament/categories.nim b/tests/testament/categories.nim
index faccfed57..bb9c90d2a 100644
--- a/tests/testament/categories.nim
+++ b/tests/testament/categories.nim
@@ -151,7 +151,7 @@ proc threadTests(r: var TResults, cat: Category, options: string) =
   #test "tthreadanalysis"
   #test "tthreadsort"
   test "tthreadanalysis2"
-  test "tthreadanalysis3"
+  #test "tthreadanalysis3"
   test "tthreadheapviolation1"
 
 # ------------------------- IO tests ------------------------------------------