summaryrefslogtreecommitdiffstats
path: root/src/testdir/test_backspace_opt.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-11-25 14:15:12 +0100
committerBram Moolenaar <Bram@vim.org>2020-11-25 14:15:12 +0100
commit5dc4e2f883896c99ebe83355822ac6067970b031 (patch)
tree5a67726f2baeacafcac36607890eb312232220f1 /src/testdir/test_backspace_opt.vim
parent448465e6872905967c97a56cd45307530795653c (diff)
patch 8.2.2046: some test failures don't give a clear errorv8.2.2046
Problem: Some test failures don't give a clear error. Solution: Use assert_match() and assert_fails() instead of assert_true(). (Ken Takata, closes #7368)
Diffstat (limited to 'src/testdir/test_backspace_opt.vim')
-rw-r--r--src/testdir/test_backspace_opt.vim20
1 files changed, 5 insertions, 15 deletions
diff --git a/src/testdir/test_backspace_opt.vim b/src/testdir/test_backspace_opt.vim
index b7e00242af..d70a6d00e4 100644
--- a/src/testdir/test_backspace_opt.vim
+++ b/src/testdir/test_backspace_opt.vim
@@ -1,15 +1,5 @@
" 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)
@@ -41,10 +31,10 @@ func Test_backspace_option()
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:'))
+ call assert_fails('set backspace=ABC', 'E474:')
+ call assert_fails('set backspace+=def', 'E474:')
" NOTE: Vim doesn't check following error...
- "call assert_equal(0, match(Exec('set backspace-=ghi'), '.*E474:'))
+ "call assert_fails('set backspace-=ghi', 'E474:')
" Check backwards compatibility with version 5.4 and earlier
set backspace=0
@@ -55,8 +45,8 @@ func Test_backspace_option()
call assert_equal('2', &backspace)
set backspace=3
call assert_equal('3', &backspace)
- call assert_false(match(Exec('set backspace=4'), '.*E474:'))
- call assert_false(match(Exec('set backspace=10'), '.*E474:'))
+ call assert_fails('set backspace=4', 'E474:')
+ call assert_fails('set backspace=10', 'E474:')
" Cleared when 'compatible' is set
set compatible