diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/options/chars_spec.lua | 27 | ||||
-rw-r--r-- | test/old/testdir/test_display.vim | 20 | ||||
-rw-r--r-- | test/old/testdir/test_listchars.vim | 76 |
3 files changed, 66 insertions, 57 deletions
diff --git a/test/functional/options/chars_spec.lua b/test/functional/options/chars_spec.lua index 64de25112a..e9c20b5da9 100644 --- a/test/functional/options/chars_spec.lua +++ b/test/functional/options/chars_spec.lua @@ -1,9 +1,9 @@ local helpers = require('test.functional.helpers')(after_each) local Screen = require('test.functional.ui.screen') local clear, command = helpers.clear, helpers.command +local pcall_err = helpers.pcall_err local eval = helpers.eval local eq = helpers.eq -local exc_exec = helpers.exc_exec local insert = helpers.insert local feed = helpers.feed local api = helpers.api @@ -17,11 +17,6 @@ describe("'fillchars'", function() screen:attach() end) - local function shouldfail(val, errval) - errval = errval or val - eq('Vim(set):E474: Invalid argument: fillchars=' .. errval, exc_exec('set fillchars=' .. val)) - end - describe('"eob" flag', function() it("uses '~' by default", function() eq('', eval('&fillchars')) @@ -64,10 +59,22 @@ describe("'fillchars'", function() end) it('handles invalid values', function() - shouldfail('eob:') -- empty string - shouldfail('eob:馬') -- doublewidth char - shouldfail('eob:xy') -- two ascii chars - shouldfail('eob:\255', 'eob:<ff>') -- invalid UTF-8 + eq( + 'Vim(set):E1511: Wrong number of characters for field "eob": fillchars=eob:', + pcall_err(command, 'set fillchars=eob:') -- empty string + ) + eq( + 'Vim(set):E1512: Wrong character width for field "eob": fillchars=eob:馬', + pcall_err(command, 'set fillchars=eob:馬') -- doublewidth char + ) + eq( + 'Vim(set):E1511: Wrong number of characters for field "eob": fillchars=eob:xy', + pcall_err(command, 'set fillchars=eob:xy') -- two ascii chars + ) + eq( + 'Vim(set):E1512: Wrong character width for field "eob": fillchars=eob:<ff>', + pcall_err(command, 'set fillchars=eob:\255') -- invalid UTF-8 + ) end) end) diff --git a/test/old/testdir/test_display.vim b/test/old/testdir/test_display.vim index bd90287400..70029dcf3c 100644 --- a/test/old/testdir/test_display.vim +++ b/test/old/testdir/test_display.vim @@ -253,12 +253,12 @@ func Test_eob_fillchars() " default value " call assert_match('eob:\~', &fillchars) " invalid values - call assert_fails(':set fillchars=eob:', 'E474:') - call assert_fails(':set fillchars=eob:xy', 'E474:') - call assert_fails(':set fillchars=eob:\255', 'E474:') - call assert_fails(':set fillchars=eob:<ff>', 'E474:') - call assert_fails(":set fillchars=eob:\x01", 'E474:') - call assert_fails(':set fillchars=eob:\\x01', 'E474:') + call assert_fails(':set fillchars=eob:', 'E1511:') + call assert_fails(':set fillchars=eob:xy', 'E1511:') + call assert_fails(':set fillchars=eob:\255', 'E1511:') + call assert_fails(':set fillchars=eob:<ff>', 'E1511:') + call assert_fails(":set fillchars=eob:\x01", 'E1512:') + call assert_fails(':set fillchars=eob:\\x01', 'E1512:') " default is ~ new redraw @@ -412,14 +412,16 @@ func Run_Test_display_lastline(euro) call StopVimInTerminal(buf) endfunc -func Test_display_lastline() +func Test_display_lastline_dump() CheckScreendump call Run_Test_display_lastline('') call Run_Test_display_lastline('euro_') +endfunc - call assert_fails(':set fillchars=lastline:', 'E474:') - call assert_fails(':set fillchars=lastline:〇', 'E474:') +func Test_display_lastline_fails() + call assert_fails(':set fillchars=lastline:', 'E1511:') + call assert_fails(':set fillchars=lastline:〇', 'E1512:') endfunc func Test_display_long_lastline() diff --git a/test/old/testdir/test_listchars.vim b/test/old/testdir/test_listchars.vim index 179bdfa4a0..b82b70746b 100644 --- a/test/old/testdir/test_listchars.vim +++ b/test/old/testdir/test_listchars.vim @@ -429,52 +429,52 @@ func Test_listchars_invalid() call assert_fails('set listchars=leadmultispace', 'E474:') " Too short - call assert_fails('set listchars=space:', 'E474:') - call assert_fails('set listchars=tab:x', 'E474:') - call assert_fails('set listchars=multispace:', 'E474:') - call assert_fails('set listchars=leadmultispace:', 'E474:') + call assert_fails('set listchars=space:', 'E1511:') + call assert_fails('set listchars=tab:x', 'E1511:') + call assert_fails('set listchars=multispace:', 'E1511:') + call assert_fails('set listchars=leadmultispace:', 'E1511:') " One occurrence too short - call assert_fails('set listchars=space:,space:x', 'E474:') - call assert_fails('set listchars=space:x,space:', 'E474:') - call assert_fails('set listchars=tab:x,tab:xx', 'E474:') - call assert_fails('set listchars=tab:xx,tab:x', 'E474:') - call assert_fails('set listchars=multispace:,multispace:x', 'E474:') - call assert_fails('set listchars=multispace:x,multispace:', 'E474:') - call assert_fails('set listchars=leadmultispace:,leadmultispace:x', 'E474:') - call assert_fails('set listchars=leadmultispace:x,leadmultispace:', 'E474:') + call assert_fails('set listchars=space:x,space:', 'E1511:') + call assert_fails('set listchars=space:,space:x', 'E1511:') + call assert_fails('set listchars=tab:xx,tab:x', 'E1511:') + call assert_fails('set listchars=tab:x,tab:xx', 'E1511:') + call assert_fails('set listchars=multispace:,multispace:x', 'E1511:') + call assert_fails('set listchars=multispace:x,multispace:', 'E1511:') + call assert_fails('set listchars=leadmultispace:,leadmultispace:x', 'E1511:') + call assert_fails('set listchars=leadmultispace:x,leadmultispace:', 'E1511:') " Too long - call assert_fails('set listchars=space:xx', 'E474:') - call assert_fails('set listchars=tab:xxxx', 'E474:') + call assert_fails('set listchars=space:xx', 'E1511:') + call assert_fails('set listchars=tab:xxxx', 'E1511:') " Has double-width character - call assert_fails('set listchars=space:·', 'E474:') - call assert_fails('set listchars=tab:·x', 'E474:') - call assert_fails('set listchars=tab:x·', 'E474:') - call assert_fails('set listchars=tab:xx·', 'E474:') - call assert_fails('set listchars=multispace:·', 'E474:') - call assert_fails('set listchars=multispace:xxx·', 'E474:') - call assert_fails('set listchars=leadmultispace:·', 'E474:') - call assert_fails('set listchars=leadmultispace:xxx·', 'E474:') + call assert_fails('set listchars=space:·', 'E1512:') + call assert_fails('set listchars=tab:·x', 'E1512:') + call assert_fails('set listchars=tab:x·', 'E1512:') + call assert_fails('set listchars=tab:xx·', 'E1512:') + call assert_fails('set listchars=multispace:·', 'E1512:') + call assert_fails('set listchars=multispace:xxx·', 'E1512:') + call assert_fails('set listchars=leadmultispace:·', 'E1512:') + call assert_fails('set listchars=leadmultispace:xxx·', 'E1512:') " Has control character - call assert_fails("set listchars=space:\x01", 'E474:') - call assert_fails("set listchars=tab:\x01x", 'E474:') - call assert_fails("set listchars=tab:x\x01", 'E474:') - call assert_fails("set listchars=tab:xx\x01", 'E474:') - call assert_fails("set listchars=multispace:\x01", 'E474:') - call assert_fails("set listchars=multispace:xxx\x01", 'E474:') - call assert_fails('set listchars=space:\\x01', 'E474:') - call assert_fails('set listchars=tab:\\x01x', 'E474:') - call assert_fails('set listchars=tab:x\\x01', 'E474:') - call assert_fails('set listchars=tab:xx\\x01', 'E474:') - call assert_fails('set listchars=multispace:\\x01', 'E474:') - call assert_fails('set listchars=multispace:xxx\\x01', 'E474:') - call assert_fails("set listchars=leadmultispace:\x01", 'E474:') - call assert_fails('set listchars=leadmultispace:\\x01', 'E474:') - call assert_fails("set listchars=leadmultispace:xxx\x01", 'E474:') - call assert_fails('set listchars=leadmultispace:xxx\\x01', 'E474:') + call assert_fails("set listchars=space:\x01", 'E1512:') + call assert_fails("set listchars=tab:\x01x", 'E1512:') + call assert_fails("set listchars=tab:x\x01", 'E1512:') + call assert_fails("set listchars=tab:xx\x01", 'E1512:') + call assert_fails("set listchars=multispace:\x01", 'E1512:') + call assert_fails("set listchars=multispace:xxx\x01", 'E1512:') + call assert_fails('set listchars=space:\\x01', 'E1512:') + call assert_fails('set listchars=tab:\\x01x', 'E1512:') + call assert_fails('set listchars=tab:x\\x01', 'E1512:') + call assert_fails('set listchars=tab:xx\\x01', 'E1512:') + call assert_fails('set listchars=multispace:\\x01', 'E1512:') + call assert_fails('set listchars=multispace:xxx\\x01', 'E1512:') + call assert_fails("set listchars=leadmultispace:\x01", 'E1512:') + call assert_fails('set listchars=leadmultispace:\\x01', 'E1512:') + call assert_fails("set listchars=leadmultispace:xxx\x01", 'E1512:') + call assert_fails('set listchars=leadmultispace:xxx\\x01', 'E1512:') enew! set ambiwidth& listchars& ff& |