mirror of
https://github.com/vlang/v.git
synced 2025-09-15 07:22:27 +03:00
sort: fix sorting by struct fields
This commit is contained in:
parent
e5e31f7210
commit
f8be2110ec
3 changed files with 69 additions and 15 deletions
|
@ -736,6 +736,9 @@ fn test_sort() {
|
|||
assert(users[0].age == 25)
|
||||
assert(users[1].age == 22)
|
||||
assert(users[2].age == 20)
|
||||
//
|
||||
users.sort(a.name < b.name) // Test sorting by string fields
|
||||
//assert users.map(it.name).join(' ') == 'Alice Bob Peter'
|
||||
}
|
||||
|
||||
fn test_f32_sort() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue