2016-10-13 19:56:18 +00:00
|
|
|
Before:
|
|
|
|
let g:loclist = [
|
2017-08-12 13:37:56 +00:00
|
|
|
\ {'bufnr': 3, 'lnum': 1, 'col': 1},
|
|
|
|
\ {'bufnr': 1, 'lnum': 5, 'col': 5},
|
|
|
|
\ {'bufnr': 2, 'lnum': 5, 'col': 5},
|
|
|
|
\ {'bufnr': 1, 'lnum': 5, 'col': 4},
|
|
|
|
\ {'bufnr': 1, 'lnum': 2, 'col': 10},
|
|
|
|
\ {'bufnr': 2, 'lnum': 1, 'col': 5},
|
|
|
|
\ {'bufnr': 1, 'lnum': 3, 'col': 2},
|
|
|
|
\ {'bufnr': 2, 'lnum': 1, 'col': 2},
|
|
|
|
\ {'bufnr': -1, 'lnum': 3, 'col': 2},
|
2016-10-13 19:56:18 +00:00
|
|
|
\]
|
|
|
|
|
|
|
|
Execute (Sort loclist with comparison function):
|
|
|
|
call sort(g:loclist, 'ale#util#LocItemCompare')
|
|
|
|
|
|
|
|
Then (loclist item should be sorted):
|
2016-10-14 19:34:21 +00:00
|
|
|
AssertEqual [
|
2017-08-12 13:37:56 +00:00
|
|
|
\ {'bufnr': -1, 'lnum': 3, 'col': 2},
|
|
|
|
\ {'bufnr': 1, 'lnum': 2, 'col': 10},
|
|
|
|
\ {'bufnr': 1, 'lnum': 3, 'col': 2},
|
|
|
|
\ {'bufnr': 1, 'lnum': 5, 'col': 4},
|
|
|
|
\ {'bufnr': 1, 'lnum': 5, 'col': 5},
|
|
|
|
\ {'bufnr': 2, 'lnum': 1, 'col': 2},
|
|
|
|
\ {'bufnr': 2, 'lnum': 1, 'col': 5},
|
|
|
|
\ {'bufnr': 2, 'lnum': 5, 'col': 5},
|
|
|
|
\ {'bufnr': 3, 'lnum': 1, 'col': 1},
|
2016-10-14 19:34:21 +00:00
|
|
|
\], g:loclist
|
2016-10-13 19:56:18 +00:00
|
|
|
|
|
|
|
After:
|
|
|
|
unlet g:loclist
|