summary refs log tree commit diff stats
path: root/tests/generics/tgenericlambda.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/generics/tgenericlambda.nim')
-rw-r--r--tests/generics/tgenericlambda.nim10
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/generics/tgenericlambda.nim b/tests/generics/tgenericlambda.nim
index a71c592c5..f7aafe1d9 100644
--- a/tests/generics/tgenericlambda.nim
+++ b/tests/generics/tgenericlambda.nim
@@ -1,5 +1,5 @@
 discard """
-  output: "10\n10"
+  output: "10\n10\n1\n2\n3"
 """
 
 proc test(x: proc (a, b: int): int) =
@@ -8,3 +8,11 @@ proc test(x: proc (a, b: int): int) =
 test(proc (a, b): auto = a + b)
 
 test do (a, b) -> auto: a + b
+
+proc foreach[T](s: seq[T], body: proc(x: T)) =
+  for e in s:
+    body(e)
+
+foreach(@[1,2,3]) do (x):
+  echo x
+