diff 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
line wrap: on
line diff
--- a/src/testdir/test_jumplist.vim
+++ b/src/testdir/test_jumplist.vim
@@ -28,11 +28,13 @@ func Test_getjumplist()
   normal G
   normal gg
 
-  call assert_equal([[
+  let expected = [[
 	      \ {'lnum': 1, 'bufnr': bnr, 'col': 0, 'coladd': 0},
 	      \ {'lnum': 50, 'bufnr': bnr, 'col': 0, 'coladd': 0},
-	      \ {'lnum': 100, 'bufnr': bnr, 'col': 0, 'coladd': 0}], 4],
-	      \ getjumplist())
+	      \ {'lnum': 100, 'bufnr': bnr, 'col': 0, 'coladd': 0}], 3]
+  call assert_equal(expected, getjumplist())
+  " jumplist doesn't change in between calls
+  call assert_equal(expected, getjumplist())
 
   " Traverse the jump list and verify the results
   5
@@ -44,12 +46,14 @@ func Test_getjumplist()
   call assert_equal(3, getjumplist()[1])
   exe "normal \<C-O>"
   normal 20%
-  call assert_equal([[
+  let expected = [[
 	      \ {'lnum': 1, 'bufnr': bnr, 'col': 0, 'coladd': 0},
 	      \ {'lnum': 50, 'bufnr': bnr, 'col': 0, 'coladd': 0},
 	      \ {'lnum': 5, 'bufnr': bnr, 'col': 0, 'coladd': 0},
-	      \ {'lnum': 100, 'bufnr': bnr, 'col': 0, 'coladd': 0}], 5],
-	      \ getjumplist())
+	      \ {'lnum': 100, 'bufnr': bnr, 'col': 0, 'coladd': 0}], 4]
+  call assert_equal(expected, getjumplist())
+  " jumplist doesn't change in between calls
+  call assert_equal(expected, getjumplist())
 
   let l = getjumplist()
   call test_garbagecollect_now()