From 780dd88b68b7a4d97c8b7ec6a8d33ab523ab04dd Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 18 Jan 2024 07:14:12 +0800 Subject: vim-patch:9.1.0039: too vague errors for 'listchars'/'fillchars' (#27070) Problem: too vague errors for 'listchars'/'fillchars' Solution: Include the field name in error message. (zeertzjq) related: #27050 closes: vim/vim#13877 https://github.com/vim/vim/commit/6a8d2e1634f8f0d7463a2786dbcbe0f38dd287a7 Co-authored-by: Cole Frankenhoff --- test/functional/options/chars_spec.lua | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) (limited to 'test/functional') 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:') -- 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:', + pcall_err(command, 'set fillchars=eob:\255') -- invalid UTF-8 + ) end) end) -- cgit