diff options
Diffstat (limited to 'tests/openarray/topenlen.nim')
-rw-r--r-- | tests/openarray/topenlen.nim | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/openarray/topenlen.nim b/tests/openarray/topenlen.nim new file mode 100644 index 000000000..164241b85 --- /dev/null +++ b/tests/openarray/topenlen.nim @@ -0,0 +1,15 @@ +discard """ + output: "7" +""" +# Tests a special bug + +proc choose(b: openArray[string]): string = return b[0] + +proc p(a, b: openArray[string]): int = + result = a.len + b.len - 1 + for j in 0 .. a.len: inc(result) + discard choose(a) + discard choose(b) + +discard choose(["sh", "-c", $p([""], ["a"])]) +echo($p(["", "ha", "abc"], ["xyz"])) #OUT 7 |