all: add strings.Builder.write_string and use write_string instead of write (#8892)

This commit is contained in:
zakuro 2021-02-22 20:18:11 +09:00 committed by GitHub
parent 36a6bc270c
commit f54c1a5cc2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
34 changed files with 402 additions and 397 deletions

View file

@ -23,11 +23,11 @@ fn test_split_parse() {
fn test_giant_string() {
mut temp_html := strings.new_builder(200)
mut parser := Parser{}
temp_html.write('<!doctype html><html><head><title>Giant String</title></head><body>')
temp_html.write_string('<!doctype html><html><head><title>Giant String</title></head><body>')
for counter := 0; counter < 2000; counter++ {
temp_html.write("<div id='name_$counter' class='several-$counter'>Look at $counter</div>")
temp_html.write_string("<div id='name_$counter' class='several-$counter'>Look at $counter</div>")
}
temp_html.write('</body></html>')
temp_html.write_string('</body></html>')
parser.parse_html(temp_html.str())
assert parser.tags.len == 4009
}