0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.1.1501: new behavior of b:changedtick not tested

Problem:    New behavior of b:changedtick not tested.
Solution:   Add a few test cases. (Daniel Hahler)
This commit is contained in:
Bram Moolenaar
2019-06-08 20:48:36 +02:00
parent 21f8d93c71
commit 260addf795
2 changed files with 40 additions and 0 deletions

View File

@@ -55,3 +55,41 @@ func Test_changedtick_fixed()
call assert_fails('unlet d["changedtick"]', 'E46:')
endfunc
func Test_changedtick_not_incremented_with_write()
new
let fname = "XChangeTick"
exe 'w ' .. fname
" :write when the buffer is not changed does not increment changedtick
let expected = b:changedtick
w
call assert_equal(expected, b:changedtick)
" :write when the buffer IS changed DOES increment changedtick
let expected = b:changedtick + 1
setlocal modified
w
call assert_equal(expected, b:changedtick)
" Two ticks: change + write
let expected = b:changedtick + 2
call setline(1, 'hello')
w
call assert_equal(expected, b:changedtick)
" Two ticks: start insert + write
let expected = b:changedtick + 2
normal! o
w
call assert_equal(expected, b:changedtick)
" Three ticks: start insert + change + write
let expected = b:changedtick + 3
normal! ochanged
w
call assert_equal(expected, b:changedtick)
bwipe
call delete(fname)
endfunc

View File

@@ -767,6 +767,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1501,
/**/
1500,
/**/