summary refs log tree commit diff stats
path: root/tests/vm/tconsttable.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/vm/tconsttable.nim')
-rw-r--r--tests/vm/tconsttable.nim19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/vm/tconsttable.nim b/tests/vm/tconsttable.nim
new file mode 100644
index 000000000..64a74a59d
--- /dev/null
+++ b/tests/vm/tconsttable.nim
@@ -0,0 +1,19 @@
+discard """
+  output: '''is
+finally
+nice!'''
+"""
+
+import tables
+
+const
+  foo = {"ah": "finally", "this": "is", "possible.": "nice!"}.toTable()
+
+# protect against overly smart compiler:
+var x = "this"
+
+echo foo[x]
+x = "ah"
+echo foo[x]
+x = "possible."
+echo foo[x]