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

builtin: add more documentation (#13160)

This commit is contained in:
jeffmikels
2022-01-14 10:27:38 -05:00
committed by GitHub
parent 4660220f4c
commit 9329b6c8c8
5 changed files with 223 additions and 40 deletions

View File

@ -843,6 +843,20 @@ fn test_sort() {
assert users[2].name == 'Peter'
}
fn test_sort_with_compare() {
mut a := ['hi', '1', '5', '3']
a.sort_with_compare(fn (a &string, b &string) int {
if a < b {
return -1
}
if a > b {
return 1
}
return 0
})
assert a == ['1', '3', '5', 'hi']
}
fn test_rune_sort() {
mut bs := [`f`, `e`, `d`, `b`, `c`, `a`]
bs.sort()