Bram Moolenaar | af6c131 | 2014-03-12 18:55:58 +0100 | [diff] [blame^] | 1 | Tests for 'undolevel' and 'lispwords' settings being global-local |
Bram Moolenaar | c1c023e | 2013-11-07 03:26:06 +0100 | [diff] [blame] | 2 | |
| 3 | STARTTEST |
| 4 | :so small.vim |
| 5 | :set nocompatible viminfo+=nviminfo ul=5 |
| 6 | :fu! FillBuffer() |
| 7 | :for i in range(1,13) |
| 8 | :put=i |
| 9 | :exe "setg ul=" . &g:ul |
| 10 | :endfor |
| 11 | :endfu |
| 12 | :fu! UndoLevel() |
| 13 | :redir @a | setglobal undolevels? | echon ' global' | setlocal undolevels? | echon ' local' |redir end |
| 14 | :$put a |
| 15 | :endfu |
| 16 | :new one |
| 17 | :0put ='ONE: expecting global undolevels: 5, local undolevels: -123456 (default)' |
| 18 | :call FillBuffer() |
| 19 | :call feedkeys(":earlier 10\n", 't') |
| 20 | :call UndoLevel() |
| 21 | :%w! test.out |
| 22 | :new two |
| 23 | :0put ='TWO: expecting global undolevels: 5, local undolevels: 2 (first) then 10 (afterwards)' |
| 24 | :setlocal ul=2 |
| 25 | :call FillBuffer() |
| 26 | :call feedkeys(":earlier 10\n", 't') |
| 27 | :call UndoLevel() |
| 28 | :setlocal ul=10 |
| 29 | :call UndoLevel() |
| 30 | :%w >> test.out |
| 31 | :wincmd p |
| 32 | :redir >>test.out | echo "global value shouldn't be changed and still be 5!" | echo 'ONE: expecting global undolevels: 5, local undolevels: -123456 (default)'|:setglobal undolevels? | echon ' global' | setlocal undolevels? | echon ' local' |echo "" |redir end |
| 33 | :new three |
| 34 | :setglobal ul=50 |
| 35 | :1put ='global value should be changed to 50' |
| 36 | :2put ='THREE: expecting global undolevels: 50, local undolevels: -123456 (default)' |
| 37 | :call UndoLevel() |
| 38 | :%w >> test.out |
| 39 | :"sleep 10 |
Bram Moolenaar | af6c131 | 2014-03-12 18:55:58 +0100 | [diff] [blame^] | 40 | :" |
| 41 | :" Testing 'lispwords' |
| 42 | :" |
| 43 | :setglobal lispwords=foo,bar,baz |
| 44 | :setlocal lispwords-=foo | setlocal lispwords+=quux |
| 45 | :redir >> test.out | echon "\nTesting 'lispwords' local value" | setglobal lispwords? | setlocal lispwords? | echo &lispwords . "\n" | redir end |
| 46 | :setlocal lispwords< |
| 47 | :redir >> test.out | echon "\nTesting 'lispwords' value reset" | setglobal lispwords? | setlocal lispwords? | echo &lispwords . "\n" | redir end |
Bram Moolenaar | c1c023e | 2013-11-07 03:26:06 +0100 | [diff] [blame] | 48 | :qa! |
| 49 | ENDTEST |
| 50 | |