aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ui/float_spec.lua
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2019-09-03 22:51:45 +0200
committerJustin M. Keyes <justinkz@gmail.com>2019-09-06 17:19:07 -0700
commitaf946046b922dc5d5285a70a23d11916d8389a5d (patch)
tree090d68a1dd675b5ad6e99abc829be0daafe2a7d9 /test/functional/ui/float_spec.lua
parent638f2b6dee7439de303bea12dec80240617e8034 (diff)
downloadrneovim-af946046b922dc5d5285a70a23d11916d8389a5d.tar.gz
rneovim-af946046b922dc5d5285a70a23d11916d8389a5d.tar.bz2
rneovim-af946046b922dc5d5285a70a23d11916d8389a5d.zip
test: Rename meth_pcall to pcall_err
- Rename `meth_pcall`. - Make `pcall_err` raise an error if the function does not fail. - Add `vim.pesc()` to treat a string as literal where a Lua pattern is expected.
Diffstat (limited to 'test/functional/ui/float_spec.lua')
-rw-r--r--test/functional/ui/float_spec.lua50
1 files changed, 25 insertions, 25 deletions
diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua
index c8cf9d830e..f6c18ba841 100644
--- a/test/functional/ui/float_spec.lua
+++ b/test/functional/ui/float_spec.lua
@@ -10,7 +10,7 @@ local meths = helpers.meths
local curbufmeths = helpers.curbufmeths
local funcs = helpers.funcs
local run = helpers.run
-local meth_pcall = helpers.meth_pcall
+local pcall_err = helpers.pcall_err
describe('floating windows', function()
before_each(function()
@@ -636,26 +636,26 @@ describe('floating windows', function()
it('API has proper error messages', function()
local buf = meths.create_buf(false,false)
- eq({false, "Invalid key 'bork'"},
- meth_pcall(meths.open_win,buf, false, {width=20,height=2,bork=true}))
- eq({false, "'win' key is only valid with relative='win'"},
- meth_pcall(meths.open_win,buf, false, {width=20,height=2,relative='editor',row=0,col=0,win=0}))
- eq({false, "Only one of 'relative' and 'external' must be used"},
- meth_pcall(meths.open_win,buf, false, {width=20,height=2,relative='editor',row=0,col=0,external=true}))
- eq({false, "Invalid value of 'relative' key"},
- meth_pcall(meths.open_win,buf, false, {width=20,height=2,relative='shell',row=0,col=0}))
- eq({false, "Invalid value of 'anchor' key"},
- meth_pcall(meths.open_win,buf, false, {width=20,height=2,relative='editor',row=0,col=0,anchor='bottom'}))
- eq({false, "All of 'relative', 'row', and 'col' has to be specified at once"},
- meth_pcall(meths.open_win,buf, false, {width=20,height=2,relative='editor'}))
- eq({false, "'width' key must be a positive Integer"},
- meth_pcall(meths.open_win,buf, false, {width=-1,height=2,relative='editor'}))
- eq({false, "'height' key must be a positive Integer"},
- meth_pcall(meths.open_win,buf, false, {width=20,height=-1,relative='editor'}))
- eq({false, "'height' key must be a positive Integer"},
- meth_pcall(meths.open_win,buf, false, {width=20,height=0,relative='editor'}))
- eq({false, "Must specify 'width' and 'height'"},
- meth_pcall(meths.open_win,buf, false, {relative='editor'}))
+ eq("Invalid key 'bork'",
+ pcall_err(meths.open_win,buf, false, {width=20,height=2,bork=true}))
+ eq("'win' key is only valid with relative='win'",
+ pcall_err(meths.open_win,buf, false, {width=20,height=2,relative='editor',row=0,col=0,win=0}))
+ eq("Only one of 'relative' and 'external' must be used",
+ pcall_err(meths.open_win,buf, false, {width=20,height=2,relative='editor',row=0,col=0,external=true}))
+ eq("Invalid value of 'relative' key",
+ pcall_err(meths.open_win,buf, false, {width=20,height=2,relative='shell',row=0,col=0}))
+ eq("Invalid value of 'anchor' key",
+ pcall_err(meths.open_win,buf, false, {width=20,height=2,relative='editor',row=0,col=0,anchor='bottom'}))
+ eq("All of 'relative', 'row', and 'col' has to be specified at once",
+ pcall_err(meths.open_win,buf, false, {width=20,height=2,relative='editor'}))
+ eq("'width' key must be a positive Integer",
+ pcall_err(meths.open_win,buf, false, {width=-1,height=2,relative='editor'}))
+ eq("'height' key must be a positive Integer",
+ pcall_err(meths.open_win,buf, false, {width=20,height=-1,relative='editor'}))
+ eq("'height' key must be a positive Integer",
+ pcall_err(meths.open_win,buf, false, {width=20,height=0,relative='editor'}))
+ eq("Must specify 'width' and 'height'",
+ pcall_err(meths.open_win,buf, false, {relative='editor'}))
end)
it('can be placed relative window or cursor', function()
@@ -4528,8 +4528,8 @@ describe('floating windows', function()
{0:~ }|
]], float_pos=expected_pos}
else
- eq({false, "UI doesn't support external windows"},
- meth_pcall(meths.win_set_config, 0, {external=true, width=30, height=2}))
+ eq("UI doesn't support external windows",
+ pcall_err(meths.win_set_config, 0, {external=true, width=30, height=2}))
return
end
@@ -4844,8 +4844,8 @@ describe('floating windows', function()
{0:~ }|
]], float_pos=expected_pos}
else
- eq({false, "UI doesn't support external windows"},
- meth_pcall(meths.win_set_config, 0, {external=true, width=65, height=4}))
+ eq("UI doesn't support external windows",
+ pcall_err(meths.win_set_config, 0, {external=true, width=65, height=4}))
end
feed(":tabnext<cr>")