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

builtin: add byte.repeat() and rune.repeat() (#12007)

This commit is contained in:
Wertzui123
2021-09-30 08:32:20 +02:00
committed by GitHub
parent f9ceb12e22
commit e3d379a1eb
4 changed files with 56 additions and 0 deletions

13
vlib/builtin/rune_test.v Normal file
View File

@ -0,0 +1,13 @@
fn test_repeat() {
r1 := `V`
r2 := `👋`
assert r1.repeat(5) == 'VVVVV'
assert r2.repeat(5) == '👋👋👋👋👋'
assert r1.repeat(1) == r1.str()
assert r2.repeat(1) == r2.str()
assert r1.repeat(0) == ''
assert r2.repeat(0) == ''
}