Mercurial > vim
comparison src/testdir/test_backspace_opt.vim @ 22999:ffb173dbf228 v8.2.2046
patch 8.2.2046: some test failures don't give a clear error
Commit: https://github.com/vim/vim/commit/5dc4e2f883896c99ebe83355822ac6067970b031
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Nov 25 14:15:12 2020 +0100
patch 8.2.2046: some test failures don't give a clear error
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)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 25 Nov 2020 14:30:05 +0100 |
parents | ff21e2962490 |
children | e7ab58f57ea3 |
comparison
equal
deleted
inserted
replaced
22998:8a52dc676c59 | 22999:ffb173dbf228 |
---|---|
1 " Tests for 'backspace' settings | 1 " Tests for 'backspace' settings |
2 | |
3 func Exec(expr) | |
4 let str='' | |
5 try | |
6 exec a:expr | |
7 catch /.*/ | |
8 let str=v:exception | |
9 endtry | |
10 return str | |
11 endfunc | |
12 | 2 |
13 func Test_backspace_option() | 3 func Test_backspace_option() |
14 set backspace= | 4 set backspace= |
15 call assert_equal('', &backspace) | 5 call assert_equal('', &backspace) |
16 set backspace=indent | 6 set backspace=indent |
39 set backspace-=start | 29 set backspace-=start |
40 call assert_equal('eol', &backspace) | 30 call assert_equal('eol', &backspace) |
41 set backspace-=eol | 31 set backspace-=eol |
42 call assert_equal('', &backspace) | 32 call assert_equal('', &backspace) |
43 " Check the error | 33 " Check the error |
44 call assert_equal(0, match(Exec('set backspace=ABC'), '.*E474:')) | 34 call assert_fails('set backspace=ABC', 'E474:') |
45 call assert_equal(0, match(Exec('set backspace+=def'), '.*E474:')) | 35 call assert_fails('set backspace+=def', 'E474:') |
46 " NOTE: Vim doesn't check following error... | 36 " NOTE: Vim doesn't check following error... |
47 "call assert_equal(0, match(Exec('set backspace-=ghi'), '.*E474:')) | 37 "call assert_fails('set backspace-=ghi', 'E474:') |
48 | 38 |
49 " Check backwards compatibility with version 5.4 and earlier | 39 " Check backwards compatibility with version 5.4 and earlier |
50 set backspace=0 | 40 set backspace=0 |
51 call assert_equal('0', &backspace) | 41 call assert_equal('0', &backspace) |
52 set backspace=1 | 42 set backspace=1 |
53 call assert_equal('1', &backspace) | 43 call assert_equal('1', &backspace) |
54 set backspace=2 | 44 set backspace=2 |
55 call assert_equal('2', &backspace) | 45 call assert_equal('2', &backspace) |
56 set backspace=3 | 46 set backspace=3 |
57 call assert_equal('3', &backspace) | 47 call assert_equal('3', &backspace) |
58 call assert_false(match(Exec('set backspace=4'), '.*E474:')) | 48 call assert_fails('set backspace=4', 'E474:') |
59 call assert_false(match(Exec('set backspace=10'), '.*E474:')) | 49 call assert_fails('set backspace=10', 'E474:') |
60 | 50 |
61 " Cleared when 'compatible' is set | 51 " Cleared when 'compatible' is set |
62 set compatible | 52 set compatible |
63 call assert_equal('', &backspace) | 53 call assert_equal('', &backspace) |
64 set nocompatible viminfo+=nviminfo | 54 set nocompatible viminfo+=nviminfo |