summary refs log tree commit diff stats
path: root/tests/js/tenumnegkey.nim
diff options
context:
space:
mode:
authorSilvio <stisa4@gmail.com>2017-03-15 10:33:37 +0100
committerAndreas Rumpf <rumpf_a@web.de>2017-03-15 10:33:37 +0100
commit51cd3bd86f73795056a051c05facb7b72685b204 (patch)
treededcfdc2f1f4a1cdcb0c3692bde3af372e7ad443 /tests/js/tenumnegkey.nim
parentebb15505dd610074bb8900e6bacd775d6e064a7f (diff)
downloadNim-51cd3bd86f73795056a051c05facb7b72685b204.tar.gz
Fixes #5062 (#5527); JS: holes in enums
Diffstat (limited to 'tests/js/tenumnegkey.nim')
-rw-r--r--tests/js/tenumnegkey.nim12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/js/tenumnegkey.nim b/tests/js/tenumnegkey.nim
new file mode 100644
index 000000000..f96c554d4
--- /dev/null
+++ b/tests/js/tenumnegkey.nim
@@ -0,0 +1,12 @@
+discard """
+  output: "first-12second32third64"
+"""
+
+type Holed = enum
+  hFirst = (-12,"first")
+  hSecond = (32,"second")
+  hThird = (64,"third")
+  
+var x = @[-12,32,64] # This is just to avoid the compiler inlining the value of the enum
+
+echo Holed(x[0]),ord Holed(x[0]),Holed(x[1]),ord Holed(x[1]),Holed(x[2]),ord Holed(x[2])