To: vim_dev@googlegroups.com Subject: Patch 7.4.1034 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.1034 Problem: There is no test for the 'backspace' option behavior. Solution: Add a test. (Hirohito Higashi) Files: src/testdir/test_alot.vim, src/testdir/test_backspace_opt.vim *** ../vim-7.4.1033/src/testdir/test_alot.vim 2016-01-01 14:48:00.646893076 +0100 --- src/testdir/test_alot.vim 2016-01-02 21:31:26.686326637 +0100 *************** *** 1,6 **** --- 1,7 ---- " A series of tests that can run in one Vim invocation. " This makes testing go faster, since Vim doesn't need to restart. + source test_backspace_opt.vim source test_lispwords.vim source test_searchpos.vim source test_set.vim *** ../vim-7.4.1033/src/testdir/test_backspace_opt.vim 2016-01-02 21:31:04.474569760 +0100 --- src/testdir/test_backspace_opt.vim 2016-01-02 21:19:31.942155138 +0100 *************** *** 0 **** --- 1,58 ---- + " Tests for 'backspace' settings + + :func Exec(expr) + let str='' + try + exec a:expr + catch /.*/ + let str=v:exception + endtry + return str + :endfunc + + func Test_backspace_option() + set backspace= + call assert_equal('', &backspace) + set backspace=indent + call assert_equal('indent', &backspace) + set backspace=eol + call assert_equal('eol', &backspace) + set backspace=start + call assert_equal('start', &backspace) + " Add the value + set backspace= + set backspace=indent + call assert_equal('indent', &backspace) + set backspace+=eol + call assert_equal('indent,eol', &backspace) + set backspace+=start + call assert_equal('indent,eol,start', &backspace) + " Delete the value + set backspace-=indent + call assert_equal('eol,start', &backspace) + set backspace-=start + call assert_equal('eol', &backspace) + set backspace-=eol + call assert_equal('', &backspace) + " Check the error + call assert_equal(0, match(Exec('set backspace=ABC'), '.*E474')) + call assert_equal(0, match(Exec('set backspace+=def'), '.*E474')) + " NOTE: Vim doesn't check following error... + "call assert_equal(0, match(Exec('set backspace-=ghi'), '.*E474')) + + " Check backwards compatibility with version 5.4 and earlier + set backspace=0 + call assert_equal('0', &backspace) + set backspace=1 + call assert_equal('1', &backspace) + set backspace=2 + call assert_equal('2', &backspace) + call assert_false(match(Exec('set backspace=3'), '.*E474')) + call assert_false(match(Exec('set backspace=10'), '.*E474')) + + " Cleared when 'compatible' is set + set compatible + call assert_equal('', &backspace) + endfunc + + " vim: tabstop=2 shiftwidth=0 expandtab *** ../vim-7.4.1033/src/version.c 2016-01-02 21:11:47.115238108 +0100 --- src/version.c 2016-01-02 21:14:34.189411340 +0100 *************** *** 743,744 **** --- 743,746 ---- { /* Add new patch number below this line */ + /**/ + 1034, /**/ -- ARTHUR: Go on, Bors, chop its head off. BORS: Right. Silly little bleeder. One rabbit stew coming up. "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///