diff options
Diffstat (limited to 'tests/enum/tenumhole.nim')
-rw-r--r-- | tests/enum/tenumhole.nim | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/tests/enum/tenumhole.nim b/tests/enum/tenumhole.nim index 68b82e283..4928572f9 100644 --- a/tests/enum/tenumhole.nim +++ b/tests/enum/tenumhole.nim @@ -1,24 +1,16 @@ discard """ file: "tenumhole.nim" - output: "my value A1my value Bconc2valueCabc4abc" + output: "first0second32third64" """ -const - strValB = "my value B" +type Holed = enum + hFirst = (0,"first") + hSecond = (32,"second") + hThird = (64,"third") + +var x = @[0,32,64] # This is just to avoid the compiler inlining the value of the enum -type - TMyEnum = enum - valueA = (1, "my value A"), - valueB = strValB & "conc", - valueC, - valueD = (4, "abc") - -# test the new "proc body can be an expr" feature: -proc getValue: TMyEnum = valueD - -# trick the optimizer with a variable: -var x = getValue() -echo valueA, ord(valueA), valueB, ord(valueB), valueC, valueD, ord(valueD), x +echo Holed(x[0]),ord Holed(x[0]),Holed(x[1]),ord Holed(x[1]),Holed(x[2]),ord Holed(x[2]) |