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:
13
vlib/builtin/rune_test.v
Normal file
13
vlib/builtin/rune_test.v
Normal 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) == ''
|
||||
}
|
Reference in New Issue
Block a user