From 9ab1a3c7248993769a752526139424017c913ffa Mon Sep 17 00:00:00 2001 From: Araq Date: Mon, 13 Jan 2014 01:05:09 +0100 Subject: added test cases from strange loop event --- tests/showoff/tonce.nim | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 tests/showoff/tonce.nim (limited to 'tests/showoff/tonce.nim') diff --git a/tests/showoff/tonce.nim b/tests/showoff/tonce.nim new file mode 100644 index 000000000..6fc372e87 --- /dev/null +++ b/tests/showoff/tonce.nim @@ -0,0 +1,22 @@ +discard """ + output: '''first call of p +some call of p +new instantiation +some call of p''' +""" + +template once(body: stmt) = + var x {.global.} = false + if not x: + x = true + body + +proc p() = + once: + echo "first call of p" + echo "some call of p" + +p() +once: + echo "new instantiation" +p() -- cgit 1.4.1-2-gfad0