1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

strings: cleanup strings builder, allow reusing it

This commit is contained in:
Delyan Angelov
2021-02-21 13:32:18 +02:00
parent 6e46f3850c
commit 514cabd7c8
2 changed files with 9 additions and 8 deletions

View File

@@ -75,3 +75,11 @@ fn test_byte_write() {
sb_final := sb.str()
assert sb_final == temp_str
}
fn test_strings_builder_reuse() {
mut sb := strings.new_builder(256)
sb.write('world')
assert sb.str() == 'world'
sb.write('hello')
assert sb.str() == 'hello'
}