From 86108be24b43d1b4b02a6549e75f64b7625233ac Mon Sep 17 00:00:00 2001 From: Zahary Karadjov Date: Wed, 25 Dec 2013 22:40:06 +0200 Subject: [PATCH] test case for semistatic --- tests/run/tsemistatic.nim | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tests/run/tsemistatic.nim diff --git a/tests/run/tsemistatic.nim b/tests/run/tsemistatic.nim new file mode 100644 index 0000000000..d187f153cc --- /dev/null +++ b/tests/run/tsemistatic.nim @@ -0,0 +1,24 @@ +discard """ + msg: "static 10\ndynamic\nstatic 20\n" + output: "s\nd\nd\ns" +""" + +proc foo(x: semistatic[int]) = + when isStatic(x): + static: echo "static ", x + echo "s" + else: + static: echo "dynamic" + echo "d" + +foo 10 + +var + x = 10 + y: int + +foo x +foo y + +foo 20 +