summary refs log tree commit diff stats
path: root/tests/tprocvar.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/tprocvar.nim')
-rw-r--r--tests/tprocvar.nim14
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/tprocvar.nim b/tests/tprocvar.nim
index ec23dcb1d..f51543dfa 100644
--- a/tests/tprocvar.nim
+++ b/tests/tprocvar.nim
@@ -1,4 +1,13 @@
 # test variables of type proc

+
+proc pa() {.cdecl.} = write(stdout, "pa")
+proc pb() {.cdecl.} = write(stdout, "pb")
+proc pc() {.cdecl.} = write(stdout, "pc")
+proc pd() {.cdecl.} = write(stdout, "pd")
+proc pe() {.cdecl.} = write(stdout, "pe")
+
+const
+  algos = [pa, pb, pc, pd, pe]
 

 var

   x: proc (a, b: int): int {.cdecl.}

@@ -6,9 +15,12 @@ var
 proc ha(c, d: int): int {.cdecl.} =

   echo(c + d)

   result = c + d

+
+for a in items(algos):
+  a()
 

 x = ha

 discard x(3, 4)

 

-#OUT 7

+#OUT papbpcpdpe7