js: fix string.bytes codegen, readline, add tests for strings (#12060)

This commit is contained in:
playX 2021-10-04 18:28:30 +03:00 committed by GitHub
parent e94e08475d
commit 8d1ba52d0c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 399 additions and 30 deletions

View file

@ -0,0 +1,14 @@
import strings
fn test_repeat() {
assert strings.repeat(`x`, 10) == 'xxxxxxxxxx'
assert strings.repeat(`a`, 1) == 'a'
assert strings.repeat(`a`, 0) == ''
}
fn test_repeat_string() {
assert strings.repeat_string('abc', 3) == 'abcabcabc'
assert strings.repeat_string('abc', 1) == 'abc'
assert strings.repeat_string('abc', 0) == ''
assert strings.repeat_string('', 200) == ''
}