1" Tests for the changelist functionality
2
3source check.vim
4
5" Tests for the getchangelist() function
6func Test_getchangelist()
7  CheckFeature jumplist
8
9  bwipe!
10  enew
11  call assert_equal([], 10->getchangelist())
12  call assert_equal([[], 0], getchangelist())
13
14  call writefile(['line1', 'line2', 'line3'], 'Xfile1.txt')
15  call writefile(['line1', 'line2', 'line3'], 'Xfile2.txt')
16
17  edit Xfile1.txt
18  exe "normal 1Goline\<C-G>u1.1"
19  exe "normal 3Goline\<C-G>u2.1"
20  exe "normal 5Goline\<C-G>u3.1"
21  normal g;
22  call assert_equal([[
23	      \ {'lnum' : 2, 'col' : 4, 'coladd' : 0},
24	      \ {'lnum' : 4, 'col' : 4, 'coladd' : 0},
25	      \ {'lnum' : 6, 'col' : 4, 'coladd' : 0}], 2],
26	      \ getchangelist('%'))
27
28  hide edit Xfile2.txt
29  exe "normal 1GOline\<C-G>u1.0"
30  exe "normal 2Goline\<C-G>u2.0"
31  call assert_equal([[
32	      \ {'lnum' : 1, 'col' : 6, 'coladd' : 0},
33	      \ {'lnum' : 3, 'col' : 6, 'coladd' : 0}], 2],
34	      \ getchangelist('%'))
35  hide enew
36
37  call assert_equal([[
38	      \ {'lnum' : 2, 'col' : 4, 'coladd' : 0},
39	      \ {'lnum' : 4, 'col' : 4, 'coladd' : 0},
40	      \ {'lnum' : 6, 'col' : 4, 'coladd' : 0}], 3], getchangelist(2))
41  call assert_equal([[
42	      \ {'lnum' : 1, 'col' : 6, 'coladd' : 0},
43	      \ {'lnum' : 3, 'col' : 6, 'coladd' : 0}], 2], getchangelist(3))
44
45  bwipe!
46  call delete('Xfile1.txt')
47  call delete('Xfile2.txt')
48endfunc
49
50" vim: shiftwidth=2 sts=2 expandtab
51