aboutsummaryrefslogtreecommitdiff
path: root/test/functional/eval
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/eval')
-rw-r--r--test/functional/eval/input_spec.lua19
-rw-r--r--test/functional/eval/json_functions_spec.lua7
-rw-r--r--test/functional/eval/server_spec.lua38
-rw-r--r--test/functional/eval/special_vars_spec.lua7
4 files changed, 57 insertions, 14 deletions
diff --git a/test/functional/eval/input_spec.lua b/test/functional/eval/input_spec.lua
index 5ae23e17d0..1e6b107c60 100644
--- a/test/functional/eval/input_spec.lua
+++ b/test/functional/eval/input_spec.lua
@@ -239,6 +239,25 @@ describe('input()', function()
{RBP1:(}{RBP2:()}{RBP1:)}^ |
]])
end)
+ it('is not hidden by :silent', function()
+ feed([[:silent call input('Foo: ')<CR>]])
+ screen:expect([[
+ {EOB:~ }|
+ {EOB:~ }|
+ {EOB:~ }|
+ Foo: ^ |
+ |
+ ]])
+ feed('Bar')
+ screen:expect([[
+ {EOB:~ }|
+ {EOB:~ }|
+ {EOB:~ }|
+ Foo: Bar^ |
+ |
+ ]])
+ feed('<CR>')
+ end)
end)
describe('inputdialog()', function()
it('works with multiline prompts', function()
diff --git a/test/functional/eval/json_functions_spec.lua b/test/functional/eval/json_functions_spec.lua
index 4d34cde849..8dcaea806e 100644
--- a/test/functional/eval/json_functions_spec.lua
+++ b/test/functional/eval/json_functions_spec.lua
@@ -776,4 +776,11 @@ describe('json_encode() function', function()
it('can dump NULL dictionary', function()
eq('{}', eval('json_encode(v:_null_dict)'))
end)
+
+ it('fails to parse NULL strings and lists', function()
+ eq('Vim(call):E474: Attempt to decode a blank string',
+ exc_exec('call json_decode($XXX_UNEXISTENT_VAR_XXX)'))
+ eq('Vim(call):E474: Attempt to decode a blank string',
+ exc_exec('call json_decode(v:_null_list)'))
+ end)
end)
diff --git a/test/functional/eval/server_spec.lua b/test/functional/eval/server_spec.lua
index 115114c3c3..393616838e 100644
--- a/test/functional/eval/server_spec.lua
+++ b/test/functional/eval/server_spec.lua
@@ -63,23 +63,33 @@ describe('serverstart(), serverstop()', function()
eq({}, funcs.serverlist())
local s = funcs.serverstart('127.0.0.1:0') -- assign random port
- assert(string.match(s, '127.0.0.1:%d+'))
- eq(s, funcs.serverlist()[1])
- clear_serverlist()
+ if #s > 0 then
+ assert(string.match(s, '127.0.0.1:%d+'))
+ eq(s, funcs.serverlist()[1])
+ clear_serverlist()
+ end
s = funcs.serverstart('127.0.0.1:') -- assign random port
- assert(string.match(s, '127.0.0.1:%d+'))
- eq(s, funcs.serverlist()[1])
- clear_serverlist()
+ if #s > 0 then
+ assert(string.match(s, '127.0.0.1:%d+'))
+ eq(s, funcs.serverlist()[1])
+ clear_serverlist()
+ end
- funcs.serverstart('127.0.0.1:12345')
- funcs.serverstart('127.0.0.1:12345') -- exists already; ignore
- funcs.serverstart('::1:12345')
- funcs.serverstart('::1:12345') -- exists already; ignore
- local expected = {
- '127.0.0.1:12345',
- '::1:12345',
- }
+ local expected = {}
+ local v4 = '127.0.0.1:12345'
+ s = funcs.serverstart(v4)
+ if #s > 0 then
+ table.insert(expected, v4)
+ funcs.serverstart(v4) -- exists already; ignore
+ end
+
+ local v6 = '::1:12345'
+ s = funcs.serverstart(v6)
+ if #s > 0 then
+ table.insert(expected, v6)
+ funcs.serverstart(v6) -- exists already; ignore
+ end
eq(expected, funcs.serverlist())
clear_serverlist()
diff --git a/test/functional/eval/special_vars_spec.lua b/test/functional/eval/special_vars_spec.lua
index 3d9358447e..b5773a5529 100644
--- a/test/functional/eval/special_vars_spec.lua
+++ b/test/functional/eval/special_vars_spec.lua
@@ -168,4 +168,11 @@ describe('Special values', function()
'Expected True but got v:null',
}, meths.get_vvar('errors'))
end)
+
+ describe('compat', function()
+ it('v:count is distinct from count', function()
+ command('let count = []') -- v:count is readonly
+ eq(1, eval('count is# g:["count"]'))
+ end)
+ end)
end)