diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2020-12-17 23:21:55 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-17 23:21:55 +0100 |
commit | 868c31e88a68ce16c5c0d9283a41fb3cfcec4c41 (patch) | |
tree | b7491387b52a396e8f99976c55058b7e8604e0de /tests | |
parent | 5d8f862bc644e1db076e7e8cc8a2fe8c99009329 (diff) | |
download | Nim-868c31e88a68ce16c5c0d9283a41fb3cfcec4c41.tar.gz |
fixes #16365 [backport] (#16381)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/destructor/tnewruntime_strutils.nim | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/tests/destructor/tnewruntime_strutils.nim b/tests/destructor/tnewruntime_strutils.nim index b0bceb4b5..0725718d7 100644 --- a/tests/destructor/tnewruntime_strutils.nim +++ b/tests/destructor/tnewruntime_strutils.nim @@ -2,7 +2,10 @@ discard """ valgrind: true cmd: '''nim c -d:nimAllocStats --newruntime -d:useMalloc $file''' output: ''' -@[(input: @["KXSC", "BGMC"]), (input: @["PXFX"]), (input: @["WXRQ", "ZSCZD"])]''' +@[(input: @["KXSC", "BGMC"]), (input: @["PXFX"]), (input: @["WXRQ", "ZSCZD"])] +14 +First tasks completed. +Second tasks completed.''' """ import strutils, os, std / wordwrap @@ -211,3 +214,30 @@ staticTests() # bug #12965 let xaa = @[""].join() let xbb = @["", ""].join() + +# bug #16365 + +# Task 1: +when true: + # Task 1_a: + var test_string_a = "name_something" + echo test_string_a.len() + let new_len_a = test_string_a.len - "_something".len() + test_string_a.setLen new_len_a + + echo "First tasks completed." + +# Task 2: +when true: + # Task 2_a + var test_string: string + let some_string = "something" + for i in some_string.items: + test_string.add $i + + # Task 2_b + var test_string_b = "name_something" + let new_len_b = test_string_b.len - "_something".len() + test_string_b.setLen new_len_b + + echo "Second tasks completed." |