comparison src/testdir/test_jumplist.vim @ 15788:c24572e66556 v8.1.0901

patch 8.1.0901: index in getjumplist() may be wrong commit https://github.com/vim/vim/commit/57ee2b6e0b5b730d12ee9db00a8e2a577df9e374 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Feb 12 22:15:06 2019 +0100 patch 8.1.0901: index in getjumplist() may be wrong Problem: Index in getjumplist() may be wrong. (Epheien) Solution: Call cleanup_jumplist() earlier. (Yegappan Lakshmanan, closes #3941)
author Bram Moolenaar <Bram@vim.org>
date Tue, 12 Feb 2019 22:30:07 +0100
parents 5958573d8a72
children 4935244c1128
comparison
equal deleted inserted replaced
15787:ecdf064c26a3 15788:c24572e66556
26 let bnr = bufnr('%') 26 let bnr = bufnr('%')
27 normal 50% 27 normal 50%
28 normal G 28 normal G
29 normal gg 29 normal gg
30 30
31 call assert_equal([[ 31 let expected = [[
32 \ {'lnum': 1, 'bufnr': bnr, 'col': 0, 'coladd': 0}, 32 \ {'lnum': 1, 'bufnr': bnr, 'col': 0, 'coladd': 0},
33 \ {'lnum': 50, 'bufnr': bnr, 'col': 0, 'coladd': 0}, 33 \ {'lnum': 50, 'bufnr': bnr, 'col': 0, 'coladd': 0},
34 \ {'lnum': 100, 'bufnr': bnr, 'col': 0, 'coladd': 0}], 4], 34 \ {'lnum': 100, 'bufnr': bnr, 'col': 0, 'coladd': 0}], 3]
35 \ getjumplist()) 35 call assert_equal(expected, getjumplist())
36 " jumplist doesn't change in between calls
37 call assert_equal(expected, getjumplist())
36 38
37 " Traverse the jump list and verify the results 39 " Traverse the jump list and verify the results
38 5 40 5
39 exe "normal \<C-O>" 41 exe "normal \<C-O>"
40 call assert_equal(2, getjumplist(1)[1]) 42 call assert_equal(2, getjumplist(1)[1])
42 call assert_equal(0, getjumplist(1, 1)[1]) 44 call assert_equal(0, getjumplist(1, 1)[1])
43 exe "normal 3\<C-I>" 45 exe "normal 3\<C-I>"
44 call assert_equal(3, getjumplist()[1]) 46 call assert_equal(3, getjumplist()[1])
45 exe "normal \<C-O>" 47 exe "normal \<C-O>"
46 normal 20% 48 normal 20%
47 call assert_equal([[ 49 let expected = [[
48 \ {'lnum': 1, 'bufnr': bnr, 'col': 0, 'coladd': 0}, 50 \ {'lnum': 1, 'bufnr': bnr, 'col': 0, 'coladd': 0},
49 \ {'lnum': 50, 'bufnr': bnr, 'col': 0, 'coladd': 0}, 51 \ {'lnum': 50, 'bufnr': bnr, 'col': 0, 'coladd': 0},
50 \ {'lnum': 5, 'bufnr': bnr, 'col': 0, 'coladd': 0}, 52 \ {'lnum': 5, 'bufnr': bnr, 'col': 0, 'coladd': 0},
51 \ {'lnum': 100, 'bufnr': bnr, 'col': 0, 'coladd': 0}], 5], 53 \ {'lnum': 100, 'bufnr': bnr, 'col': 0, 'coladd': 0}], 4]
52 \ getjumplist()) 54 call assert_equal(expected, getjumplist())
55 " jumplist doesn't change in between calls
56 call assert_equal(expected, getjumplist())
53 57
54 let l = getjumplist() 58 let l = getjumplist()
55 call test_garbagecollect_now() 59 call test_garbagecollect_now()
56 call assert_equal(4, l[1]) 60 call assert_equal(4, l[1])
57 clearjumps 61 clearjumps