summary refs log tree commit diff stats
path: root/tests/run
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2012-06-17 02:11:13 +0200
committerAraq <rumpf_a@web.de>2012-06-17 02:11:13 +0200
commit7076f07228f65b05312b609f89dbac767b69394f (patch)
tree9c43de800eea5fa093ea964a6e4ba9a6085f94fa /tests/run
parent7b539c9e582e441cdb7e078cdbe247d06a74ad0e (diff)
downloadNim-7076f07228f65b05312b609f89dbac767b69394f.tar.gz
tinterf.nim works now
Diffstat (limited to 'tests/run')
-rw-r--r--tests/run/tclosure2.nim17
-rw-r--r--tests/run/tinterf.nim20
2 files changed, 29 insertions, 8 deletions
diff --git a/tests/run/tclosure2.nim b/tests/run/tclosure2.nim
index b44c92db7..47cf8fa11 100644
--- a/tests/run/tclosure2.nim
+++ b/tests/run/tclosure2.nim
@@ -19,15 +19,16 @@ py'''
 
 when true:
   proc ax =
-    var i = 0
-    proc bx =
-      if i > 10: return
-      i += 1
-      #for j in 0 .. 0: echo i
+    for xxxx in 0..9:
+      var i = 0
+      proc bx =
+        if i > 10: return
+        i += 1
+        #for j in 0 .. 0: echo i
+        bx()
+      
       bx()
-    
-    bx()
-    echo i
+      echo i
 
   ax()
 
diff --git a/tests/run/tinterf.nim b/tests/run/tinterf.nim
new file mode 100644
index 000000000..b082b1d3f
--- /dev/null
+++ b/tests/run/tinterf.nim
@@ -0,0 +1,20 @@
+discard """
+  output: '''56'''
+"""
+
+type
+  ITest = tuple[
+    setter: proc(v: int) {.closure.},
+    getter: proc(): int {.closure.}]
+
+proc getInterf(): ITest =
+  var shared: int
+  
+  return (setter: proc (x: int) = shared = x,
+          getter: proc (): int = return shared)
+
+var i = getInterf()
+i.setter(56)
+
+echo i.getter()
+