summary refs log tree commit diff stats
path: root/tests/ic/mcompiletime_counter.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ic/mcompiletime_counter.nim')
-rw-r--r--tests/ic/mcompiletime_counter.nim15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/ic/mcompiletime_counter.nim b/tests/ic/mcompiletime_counter.nim
new file mode 100644
index 000000000..6fc7b3f2a
--- /dev/null
+++ b/tests/ic/mcompiletime_counter.nim
@@ -0,0 +1,15 @@
+
+import std/macros
+import std/macrocache
+
+const myCounter = CacheCounter"myCounter"
+
+proc getUniqueId*(): int {.compileTime.} =
+  inc myCounter
+  result = myCounter.value
+
+static:
+  myCounter.inc(3)
+  assert myCounter.value == 3
+
+