comparison src/testdir/test_undolevels.vim @ 7279:b5e9810b389d v7.4.945

commit https://github.com/vim/vim/commit/683fa185a4b4ed7595e5942901548b8239ed5cdb Author: Bram Moolenaar <Bram@vim.org> Date: Mon Nov 30 21:38:24 2015 +0100 patch 7.4.945 Problem: New style testing is incomplete. Solution: Add the runtest script to the list of distributed files. Add the new functions to the function overview. Rename the functions to match Vim function style. Move undolevels testing into a new style test script.
author Christian Brabandt <cb@256bit.org>
date Mon, 30 Nov 2015 21:45:04 +0100
parents
children 17bbbca531be
comparison
equal deleted inserted replaced
7278:cbb385c32701 7279:b5e9810b389d
1 " Tests for 'undolevels'
2
3 set nocompatible viminfo+=nviminfo
4
5 func FillBuffer()
6 for i in range(1,13)
7 put=i
8 " Set 'undolevels' to split undo.
9 exe "setg ul=" . &g:ul
10 endfor
11 endfunc
12
13 func Test_global_local_undolevels()
14 new one
15 set undolevels=5
16 call FillBuffer()
17 " will only undo the last 5 changes, end up with 13 - (5 + 1) = 7 lines
18 earlier 10
19 call assert_equal(5, &g:undolevels)
20 call assert_equal(-123456, &l:undolevels)
21 call assert_equal('7', getline('$'))
22
23 new two
24 setlocal undolevels=2
25 call FillBuffer()
26 " will only undo the last 2 changes, end up with 13 - (2 + 1) = 10 lines
27 earlier 10
28 call assert_equal(5, &g:undolevels)
29 call assert_equal(2, &l:undolevels)
30 call assert_equal('10', getline('$'))
31
32 setlocal ul=10
33 call assert_equal(5, &g:undolevels)
34 call assert_equal(10, &l:undolevels)
35
36 " Setting local value in "two" must not change local value in "one"
37 wincmd p
38 call assert_equal(5, &g:undolevels)
39 call assert_equal(-123456, &l:undolevels)
40
41 new three
42 setglobal ul=50
43 call assert_equal(50, &g:undolevels)
44 call assert_equal(-123456, &l:undolevels)
45
46 endfunc