diff options
Diffstat (limited to 'test/functional/eval')
-rw-r--r-- | test/functional/eval/json_functions_spec.lua | 7 | ||||
-rw-r--r-- | test/functional/eval/server_spec.lua | 38 |
2 files changed, 31 insertions, 14 deletions
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() |