summaryrefslogtreecommitdiff
path: root/test/test_loclist_sorting.vader
blob: c095bdda00e43646ef5b4691cfcb5b92af06a516 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Before:
  let g:loclist = [
  \ {'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},
  \]

Execute (Sort loclist with comparison function):
  call sort(g:loclist, 'ale#util#LocItemCompare')

Then (loclist item should be sorted):
  AssertEqual [
  \ {'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},
  \], g:loclist

After:
  unlet g:loclist