aboutsummaryrefslogtreecommitdiff
path: root/test/functional/options/chars_spec.lua
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-01-18 07:14:12 +0800
committerGitHub <noreply@github.com>2024-01-18 07:14:12 +0800
commit780dd88b68b7a4d97c8b7ec6a8d33ab523ab04dd (patch)
tree6d50492bb8e1f6110661edaa14b570ebb0f5b05c /test/functional/options/chars_spec.lua
parent5aa14e1231b7eccfbc54cba8f20d54105212847d (diff)
downloadrneovim-780dd88b68b7a4d97c8b7ec6a8d33ab523ab04dd.tar.gz
rneovim-780dd88b68b7a4d97c8b7ec6a8d33ab523ab04dd.tar.bz2
rneovim-780dd88b68b7a4d97c8b7ec6a8d33ab523ab04dd.zip
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 <cole.nhf@gmail.com>
Diffstat (limited to 'test/functional/options/chars_spec.lua')
-rw-r--r--test/functional/options/chars_spec.lua27
1 files changed, 17 insertions, 10 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)