summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2011-07-31 14:57:38 +0200
committerAraq <rumpf_a@web.de>2011-07-31 14:57:38 +0200
commit4f7fa0591112e70f7eacef051a215e3420f78da8 (patch)
treebc1ba0fda506403d488154fa1c599d2ac54f3c6d /tests
parent00da785f5dce911321f63230b7f87a7d143d2133 (diff)
downloadNim-4f7fa0591112e70f7eacef051a215e3420f78da8.tar.gz
void type improvements; documentation improvements
Diffstat (limited to 'tests')
-rwxr-xr-xtests/accept/compile/tdictdestruct.nim5
-rw-r--r--tests/accept/compile/tvoid.nim28
2 files changed, 25 insertions, 8 deletions
diff --git a/tests/accept/compile/tdictdestruct.nim b/tests/accept/compile/tdictdestruct.nim
index 9c1f27ed8..09e173b7c 100755
--- a/tests/accept/compile/tdictdestruct.nim
+++ b/tests/accept/compile/tdictdestruct.nim
@@ -1,6 +1,3 @@
-discard """
-  disabled: true
-"""
 
 type
   TDict[TK, TV] = object
@@ -14,7 +11,7 @@ proc fakeNew[T](x: var ref T, destroy: proc (a: ref T)) =
 proc destroyDict[TK, TV](a: PDict[TK, TV]) =
     return
 proc newDict[TK, TV](a: TK, b: TV): PDict[TK, TV] =
-    Fakenew(result, destroyDict)
+    Fakenew(result, destroyDict[TK, TV])
 
 # Problem: destroyDict is not instantiated when newDict is instantiated!    
 
diff --git a/tests/accept/compile/tvoid.nim b/tests/accept/compile/tvoid.nim
index 5ef076293..b286010dc 100644
--- a/tests/accept/compile/tvoid.nim
+++ b/tests/accept/compile/tvoid.nim
@@ -1,13 +1,33 @@
 discard """
-  output: "he, no return type; a string"
+  output: "he, no return type;abc a string"
 """
 
-proc ReturnT[T](): T =
+proc ReturnT[T](x: T): T =
   when T is void:
     echo "he, no return type;"
   else:
-    result = " a string"
+    result = x & " a string"
+
+proc nothing(x, y: void): void =
+  echo "ha"
+
+proc callProc[T](p: proc (x: T), x: T) =
+  when T is void: 
+    p()
+  else:
+    p(x)
+
+proc intProc(x: int) =
+  echo x
+  
+proc emptyProc() =
+  echo "empty"
+
+callProc[int](intProc, 12)
+callProc[void](emptyProc)
+
 
 ReturnT[void]()
-echo ReturnT[string]()
+echo ReturnT[string]("abc")
+nothing()