tests: Add missing test cases

This commit is contained in:
ZyX 2017-11-05 21:06:12 +03:00
parent 7bc6de7526
commit 7849070f99
4 changed files with 1455 additions and 897 deletions

View File

@ -971,6 +971,11 @@ Dictionary nvim_parse_expression(String expr, String flags, Boolean highlight,
switch (flags.data[i]) {
case 'm': { pflags |= kExprFlagsMulti; break; }
case 'E': { pflags |= kExprFlagsDisallowEOC; break; }
case NUL: {
api_set_error(err, kErrorTypeValidation, "Invalid flag: '\\0' (%u)",
(unsigned)flags.data[i]);
return (Dictionary)ARRAY_DICT_INIT;
}
default: {
api_set_error(err, kErrorTypeValidation, "Invalid flag: '%c' (%u)",
flags.data[i], (unsigned)flags.data[i]);
@ -995,6 +1000,7 @@ Dictionary nvim_parse_expression(String expr, String flags, Boolean highlight,
&pstate, parser_simple_get_line, &plines_p, colors_p);
ExprAST east = viml_pexpr_parse(&pstate, pflags);
// FIXME add parse_length key
const size_t ret_size = (
1 // "ast"
+ (size_t)(east.err.msg != NULL) // "error"

File diff suppressed because it is too large Load Diff

View File

@ -271,6 +271,45 @@ local function shallowcopy(orig)
return copy
end
local deepcopy
local function id(v)
return v
end
local deepcopy_funcs = {
table = function(orig)
local copy = {}
for k, v in pairs(orig) do
copy[deepcopy(k)] = deepcopy(v)
end
end,
number = id,
string = id,
['nil'] = id,
boolean = id,
}
deepcopy = function(orig)
return deepcopy_funcs[type(orig)](orig)
end
local REMOVE_THIS = {}
local function mergedicts_copy(d1, d2)
local ret = shallowcopy(d1)
for k, v in pairs(d2) do
if d2[k] == REMOVE_THIS then
ret[k] = nil
elseif type(d1[k]) == 'table' and type(d2[k]) == 'table' then
ret[k] = mergedicts_copy(d1[k], d2[k])
else
ret[k] = d2[k]
end
end
return ret
end
local function concat_tables(...)
local ret = {}
for i = 1, select('#', ...) do
@ -413,6 +452,9 @@ return {
hasenv = hasenv,
which = which,
shallowcopy = shallowcopy,
deepcopy = deepcopy,
mergedicts_copy = mergedicts_copy,
REMOVE_THIS = REMOVE_THIS,
concat_tables = concat_tables,
dedent = dedent,
format_luav = format_luav,

File diff suppressed because it is too large Load Diff