diff options
Diffstat (limited to 'tests/casestmt/tlinearscanend.nim')
-rw-r--r-- | tests/casestmt/tlinearscanend.nim | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/casestmt/tlinearscanend.nim b/tests/casestmt/tlinearscanend.nim new file mode 100644 index 000000000..96e3727d5 --- /dev/null +++ b/tests/casestmt/tlinearscanend.nim @@ -0,0 +1,26 @@ +discard """ +action: compile +""" + +import strutils + +var x = 343 + +case stdin.readline.parseInt +of 0: + echo "most common case" +of 1: + {.linearScanEnd.} + echo "second most common case" +of 2: echo "unlikely: use branch table" +else: + echo "unlikely too: use branch table" + + +case x +of 23: echo "23" +of 343: echo "343" +of 21: echo "21" +else: + {.linearScanEnd.} + echo "default" |