mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:8.1.1355: obvious mistakes are accepted as valid expressions
Problem: Obvious mistakes are accepted as valid expressions.
Solution: Be more strict about parsing numbers. (Yasuhiro Matsumoto,
closes vim/vim#3981)
16e9b85113
Update vim_str2nr_spec.lua to add more tests that use strict = true.
This commit is contained in:
parent
cd18fe17a8
commit
34cb087955
@ -1397,6 +1397,7 @@ bool vim_isblankline(char_u *lbuf)
|
|||||||
/// If "what" contains STR2NR_HEX recognize hex numbers.
|
/// If "what" contains STR2NR_HEX recognize hex numbers.
|
||||||
/// If "what" contains STR2NR_FORCE always assume bin/oct/hex.
|
/// If "what" contains STR2NR_FORCE always assume bin/oct/hex.
|
||||||
/// If maxlen > 0, check at a maximum maxlen chars.
|
/// If maxlen > 0, check at a maximum maxlen chars.
|
||||||
|
/// If strict is true, check the number strictly. return *len = 0 if fail.
|
||||||
///
|
///
|
||||||
/// @param start
|
/// @param start
|
||||||
/// @param prep Returns guessed type of number 0 = decimal, 'x' or 'X' is
|
/// @param prep Returns guessed type of number 0 = decimal, 'x' or 'X' is
|
||||||
@ -1407,9 +1408,12 @@ bool vim_isblankline(char_u *lbuf)
|
|||||||
/// @param nptr Returns the signed result.
|
/// @param nptr Returns the signed result.
|
||||||
/// @param unptr Returns the unsigned result.
|
/// @param unptr Returns the unsigned result.
|
||||||
/// @param maxlen Max length of string to check.
|
/// @param maxlen Max length of string to check.
|
||||||
|
/// @param strict If true, fail if the number has unexpected trailing
|
||||||
|
/// alpha-numeric chars: *len is set to 0 and nothing else is
|
||||||
|
/// returned.
|
||||||
void vim_str2nr(const char_u *const start, int *const prep, int *const len,
|
void vim_str2nr(const char_u *const start, int *const prep, int *const len,
|
||||||
const int what, varnumber_T *const nptr,
|
const int what, varnumber_T *const nptr,
|
||||||
uvarnumber_T *const unptr, const int maxlen)
|
uvarnumber_T *const unptr, const int maxlen, const bool strict)
|
||||||
FUNC_ATTR_NONNULL_ARG(1)
|
FUNC_ATTR_NONNULL_ARG(1)
|
||||||
{
|
{
|
||||||
const char *ptr = (const char *)start;
|
const char *ptr = (const char *)start;
|
||||||
@ -1419,6 +1423,10 @@ void vim_str2nr(const char_u *const start, int *const prep, int *const len,
|
|||||||
const bool negative = (ptr[0] == '-');
|
const bool negative = (ptr[0] == '-');
|
||||||
uvarnumber_T un = 0;
|
uvarnumber_T un = 0;
|
||||||
|
|
||||||
|
if (len != NULL) {
|
||||||
|
*len = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (negative) {
|
if (negative) {
|
||||||
ptr++;
|
ptr++;
|
||||||
}
|
}
|
||||||
@ -1492,7 +1500,7 @@ void vim_str2nr(const char_u *const start, int *const prep, int *const len,
|
|||||||
goto vim_str2nr_dec;
|
goto vim_str2nr_dec;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do the string-to-numeric conversion "manually" to avoid sscanf quirks.
|
// Do the conversion manually to avoid sscanf() quirks.
|
||||||
abort(); // Should’ve used goto earlier.
|
abort(); // Should’ve used goto earlier.
|
||||||
#define PARSE_NUMBER(base, cond, conv) \
|
#define PARSE_NUMBER(base, cond, conv) \
|
||||||
do { \
|
do { \
|
||||||
@ -1524,6 +1532,12 @@ vim_str2nr_hex:
|
|||||||
#undef PARSE_NUMBER
|
#undef PARSE_NUMBER
|
||||||
|
|
||||||
vim_str2nr_proceed:
|
vim_str2nr_proceed:
|
||||||
|
// Check for an alpha-numeric character immediately following, that is
|
||||||
|
// most likely a typo.
|
||||||
|
if (strict && ptr - (const char *)start != maxlen && ASCII_ISALNUM(*ptr)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (prep != NULL) {
|
if (prep != NULL) {
|
||||||
*prep = pre;
|
*prep = pre;
|
||||||
}
|
}
|
||||||
|
@ -3950,7 +3950,12 @@ static int eval7(
|
|||||||
rettv->vval.v_float = f;
|
rettv->vval.v_float = f;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
vim_str2nr(*arg, NULL, &len, STR2NR_ALL, &n, NULL, 0);
|
vim_str2nr(*arg, NULL, &len, STR2NR_ALL, &n, NULL, 0, true);
|
||||||
|
if (len == 0) {
|
||||||
|
EMSG2(_(e_invexpr2), *arg);
|
||||||
|
ret = FAIL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
*arg += len;
|
*arg += len;
|
||||||
if (evaluate) {
|
if (evaluate) {
|
||||||
rettv->v_type = VAR_NUMBER;
|
rettv->v_type = VAR_NUMBER;
|
||||||
|
@ -437,7 +437,7 @@ static inline int parse_json_string(const char *const buf, const size_t buf_len,
|
|||||||
t += 4;
|
t += 4;
|
||||||
uvarnumber_T ch;
|
uvarnumber_T ch;
|
||||||
vim_str2nr((char_u *)ubuf, NULL, NULL,
|
vim_str2nr((char_u *)ubuf, NULL, NULL,
|
||||||
STR2NR_HEX | STR2NR_FORCE, NULL, &ch, 4);
|
STR2NR_HEX | STR2NR_FORCE, NULL, &ch, 4, true);
|
||||||
if (ch == 0) {
|
if (ch == 0) {
|
||||||
hasnul = true;
|
hasnul = true;
|
||||||
}
|
}
|
||||||
@ -611,8 +611,8 @@ parse_json_number_check:
|
|||||||
// Convert integer
|
// Convert integer
|
||||||
varnumber_T nr;
|
varnumber_T nr;
|
||||||
int num_len;
|
int num_len;
|
||||||
vim_str2nr((char_u *) s, NULL, &num_len, 0, &nr, NULL, (int) (p - s));
|
vim_str2nr((char_u *)s, NULL, &num_len, 0, &nr, NULL, (int)(p - s), true);
|
||||||
if ((int) exp_num_len != num_len) {
|
if ((int)exp_num_len != num_len) {
|
||||||
emsgf(_("E685: internal error: while converting number \"%.*s\" "
|
emsgf(_("E685: internal error: while converting number \"%.*s\" "
|
||||||
"to integer vim_str2nr consumed %i bytes in place of %zu"),
|
"to integer vim_str2nr consumed %i bytes in place of %zu"),
|
||||||
(int) exp_num_len, s, num_len, exp_num_len);
|
(int) exp_num_len, s, num_len, exp_num_len);
|
||||||
|
@ -10030,7 +10030,8 @@ static void f_str2nr(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
|||||||
what = 0;
|
what = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
vim_str2nr(p, NULL, NULL, what, &n, NULL, 0);
|
vim_str2nr(p, NULL, NULL, what, &n, NULL, 0, false);
|
||||||
|
// Text after the number is silently ignored.
|
||||||
if (isneg) {
|
if (isneg) {
|
||||||
rettv->vval.v_number = -n;
|
rettv->vval.v_number = -n;
|
||||||
} else {
|
} else {
|
||||||
|
@ -2990,7 +2990,8 @@ varnumber_T tv_get_number_chk(const typval_T *const tv, bool *const ret_error)
|
|||||||
case VAR_STRING: {
|
case VAR_STRING: {
|
||||||
varnumber_T n = 0;
|
varnumber_T n = 0;
|
||||||
if (tv->vval.v_string != NULL) {
|
if (tv->vval.v_string != NULL) {
|
||||||
vim_str2nr(tv->vval.v_string, NULL, NULL, STR2NR_ALL, &n, NULL, 0);
|
vim_str2nr(tv->vval.v_string, NULL, NULL, STR2NR_ALL, &n, NULL, 0,
|
||||||
|
false);
|
||||||
}
|
}
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
@ -609,7 +609,7 @@ void ex_sort(exarg_T *eap)
|
|||||||
} else {
|
} else {
|
||||||
nrs[lnum - eap->line1].st_u.num.is_number = true;
|
nrs[lnum - eap->line1].st_u.num.is_number = true;
|
||||||
vim_str2nr(s, NULL, NULL, sort_what,
|
vim_str2nr(s, NULL, NULL, sort_what,
|
||||||
&nrs[lnum - eap->line1].st_u.num.value, NULL, 0);
|
&nrs[lnum - eap->line1].st_u.num.value, NULL, 0, false);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
s = skipwhite(p);
|
s = skipwhite(p);
|
||||||
|
@ -6056,7 +6056,7 @@ int get_list_range(char_u **str, int *num1, int *num2)
|
|||||||
|
|
||||||
*str = skipwhite(*str);
|
*str = skipwhite(*str);
|
||||||
if (**str == '-' || ascii_isdigit(**str)) { // parse "from" part of range
|
if (**str == '-' || ascii_isdigit(**str)) { // parse "from" part of range
|
||||||
vim_str2nr(*str, NULL, &len, 0, &num, NULL, 0);
|
vim_str2nr(*str, NULL, &len, 0, &num, NULL, 0, false);
|
||||||
*str += len;
|
*str += len;
|
||||||
*num1 = (int)num;
|
*num1 = (int)num;
|
||||||
first = true;
|
first = true;
|
||||||
@ -6064,7 +6064,7 @@ int get_list_range(char_u **str, int *num1, int *num2)
|
|||||||
*str = skipwhite(*str);
|
*str = skipwhite(*str);
|
||||||
if (**str == ',') { // parse "to" part of range
|
if (**str == ',') { // parse "to" part of range
|
||||||
*str = skipwhite(*str + 1);
|
*str = skipwhite(*str + 1);
|
||||||
vim_str2nr(*str, NULL, &len, 0, &num, NULL, 0);
|
vim_str2nr(*str, NULL, &len, 0, &num, NULL, 0, false);
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
*num2 = (int)num;
|
*num2 = (int)num;
|
||||||
*str = skipwhite(*str + len);
|
*str = skipwhite(*str + len);
|
||||||
|
@ -628,7 +628,11 @@ int find_special_key(const char_u **srcp, const size_t src_len, int *const modp,
|
|||||||
if (end - bp > 3 && bp[0] == 't' && bp[1] == '_') {
|
if (end - bp > 3 && bp[0] == 't' && bp[1] == '_') {
|
||||||
bp += 3; // skip t_xx, xx may be '-' or '>'
|
bp += 3; // skip t_xx, xx may be '-' or '>'
|
||||||
} else if (end - bp > 4 && STRNICMP(bp, "char-", 5) == 0) {
|
} else if (end - bp > 4 && STRNICMP(bp, "char-", 5) == 0) {
|
||||||
vim_str2nr(bp + 5, NULL, &l, STR2NR_ALL, NULL, NULL, 0);
|
vim_str2nr(bp + 5, NULL, &l, STR2NR_ALL, NULL, NULL, 0, true);
|
||||||
|
if (l == 0) {
|
||||||
|
EMSG(_(e_invarg));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
bp += l + 5;
|
bp += l + 5;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -654,7 +658,11 @@ int find_special_key(const char_u **srcp, const size_t src_len, int *const modp,
|
|||||||
if (STRNICMP(last_dash + 1, "char-", 5) == 0
|
if (STRNICMP(last_dash + 1, "char-", 5) == 0
|
||||||
&& ascii_isdigit(last_dash[6])) {
|
&& ascii_isdigit(last_dash[6])) {
|
||||||
// <Char-123> or <Char-033> or <Char-0x33>
|
// <Char-123> or <Char-033> or <Char-0x33>
|
||||||
vim_str2nr(last_dash + 6, NULL, NULL, STR2NR_ALL, NULL, &n, 0);
|
vim_str2nr(last_dash + 6, NULL, &l, STR2NR_ALL, NULL, &n, 0, true);
|
||||||
|
if (l == 0) {
|
||||||
|
EMSG(_(e_invarg));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
key = (int)n;
|
key = (int)n;
|
||||||
} else {
|
} else {
|
||||||
int off = 1;
|
int off = 1;
|
||||||
|
@ -5017,7 +5017,7 @@ int do_addsub(int op_type, pos_T *pos, int length, linenr_T Prenum1)
|
|||||||
0 + (do_bin ? STR2NR_BIN : 0)
|
0 + (do_bin ? STR2NR_BIN : 0)
|
||||||
+ (do_oct ? STR2NR_OCT : 0)
|
+ (do_oct ? STR2NR_OCT : 0)
|
||||||
+ (do_hex ? STR2NR_HEX : 0),
|
+ (do_hex ? STR2NR_HEX : 0),
|
||||||
NULL, &n, maxlen);
|
NULL, &n, maxlen, false);
|
||||||
|
|
||||||
// ignore leading '-' for hex, octal and bin numbers
|
// ignore leading '-' for hex, octal and bin numbers
|
||||||
if (pre && negative) {
|
if (pre && negative) {
|
||||||
|
@ -1276,9 +1276,9 @@ int do_set(
|
|||||||
}
|
}
|
||||||
} else if (*arg == '-' || ascii_isdigit(*arg)) {
|
} else if (*arg == '-' || ascii_isdigit(*arg)) {
|
||||||
// Allow negative, octal and hex numbers.
|
// Allow negative, octal and hex numbers.
|
||||||
vim_str2nr(arg, NULL, &i, STR2NR_ALL, &value, NULL, 0);
|
vim_str2nr(arg, NULL, &i, STR2NR_ALL, &value, NULL, 0, true);
|
||||||
if (arg[i] != NUL && !ascii_iswhite(arg[i])) {
|
if (i == 0 || (arg[i] != NUL && !ascii_iswhite(arg[i]))) {
|
||||||
errmsg = e_invarg;
|
errmsg = (char_u *)N_("E521: Number required after =");
|
||||||
goto skip;
|
goto skip;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -502,6 +502,17 @@ func Test_empty_concatenate()
|
|||||||
call assert_equal('b', 'b' . 'a'[4:0])
|
call assert_equal('b', 'b' . 'a'[4:0])
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_broken_number()
|
||||||
|
let X = 'bad'
|
||||||
|
call assert_fails('echo 1X', 'E15:')
|
||||||
|
call assert_fails('echo 0b1X', 'E15:')
|
||||||
|
call assert_fails('echo 0b12', 'E15:')
|
||||||
|
call assert_fails('echo 0x1X', 'E15:')
|
||||||
|
call assert_fails('echo 011X', 'E15:')
|
||||||
|
call assert_equal(2, str2nr('2a'))
|
||||||
|
call assert_fails('inoremap <Char-0b1z> b', 'E474:')
|
||||||
|
endfunc
|
||||||
|
|
||||||
func Test_eval_after_if()
|
func Test_eval_after_if()
|
||||||
let s:val = ''
|
let s:val = ''
|
||||||
func SetVal(x)
|
func SetVal(x)
|
||||||
|
@ -351,7 +351,7 @@ LexExprToken viml_pexpr_next_token(ParserState *const pstate, const int flags)
|
|||||||
}
|
}
|
||||||
if (exp_start) {
|
if (exp_start) {
|
||||||
vim_str2nr(pline.data + exp_start, NULL, NULL, 0, NULL, &exp_part,
|
vim_str2nr(pline.data + exp_start, NULL, NULL, 0, NULL, &exp_part,
|
||||||
(int)(ret.len - exp_start));
|
(int)(ret.len - exp_start), false);
|
||||||
}
|
}
|
||||||
if (exp_negative) {
|
if (exp_negative) {
|
||||||
exp_part += frac_size;
|
exp_part += frac_size;
|
||||||
@ -369,7 +369,7 @@ LexExprToken viml_pexpr_next_token(ParserState *const pstate, const int flags)
|
|||||||
int len;
|
int len;
|
||||||
int prep;
|
int prep;
|
||||||
vim_str2nr(pline.data, &prep, &len, STR2NR_ALL, NULL,
|
vim_str2nr(pline.data, &prep, &len, STR2NR_ALL, NULL,
|
||||||
&ret.data.num.val.integer, (int)pline.size);
|
&ret.data.num.val.integer, (int)pline.size, false);
|
||||||
ret.len = (size_t)len;
|
ret.len = (size_t)len;
|
||||||
const uint8_t bases[] = {
|
const uint8_t bases[] = {
|
||||||
[0] = 10,
|
[0] = 10,
|
||||||
|
@ -43,7 +43,8 @@ local function argreset(arg, args)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function test_vim_str2nr(s, what, exp, maxlen)
|
local function test_vim_str2nr(s, what, exp, maxlen, strict)
|
||||||
|
if strict == nil then strict = true end
|
||||||
local bits = {}
|
local bits = {}
|
||||||
for k, _ in pairs(exp) do
|
for k, _ in pairs(exp) do
|
||||||
bits[#bits + 1] = k
|
bits[#bits + 1] = k
|
||||||
@ -62,11 +63,11 @@ local function test_vim_str2nr(s, what, exp, maxlen)
|
|||||||
cv[k] = args[k]
|
cv[k] = args[k]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
lib.vim_str2nr(s, cv.pre, cv.len, what, cv.num, cv.unum, maxlen)
|
lib.vim_str2nr(s, cv.pre, cv.len, what, cv.num, cv.unum, maxlen, strict)
|
||||||
for cck, ccv in pairs(cv) do
|
for cck, ccv in pairs(cv) do
|
||||||
if exp[cck] ~= tonumber(ccv[0]) then
|
if exp[cck] ~= tonumber(ccv[0]) then
|
||||||
error(('Failed check (%s = %d) in test (s=%s, w=%u, m=%d): %d'):format(
|
error(('Failed check (%s = %d) in test (s=%s, w=%u, m=%d, strict=%s): %d'):format(
|
||||||
cck, exp[cck], s, tonumber(what), maxlen, tonumber(ccv[0])
|
cck, exp[cck], s, tonumber(what), maxlen, tostring(strict), tonumber(ccv[0])
|
||||||
))
|
))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -106,22 +107,28 @@ describe('vim_str2nr()', function()
|
|||||||
-- Check that all digits are recognized
|
-- Check that all digits are recognized
|
||||||
test_vim_str2nr( '12345', flags, {len = 5, num = 12345, unum = 12345, pre = 0}, 0)
|
test_vim_str2nr( '12345', flags, {len = 5, num = 12345, unum = 12345, pre = 0}, 0)
|
||||||
test_vim_str2nr( '67890', flags, {len = 5, num = 67890, unum = 67890, pre = 0}, 0)
|
test_vim_str2nr( '67890', flags, {len = 5, num = 67890, unum = 67890, pre = 0}, 0)
|
||||||
test_vim_str2nr( '12345A', flags, {len = 5, num = 12345, unum = 12345, pre = 0}, 0)
|
test_vim_str2nr( '12345A', flags, {len = 0}, 0)
|
||||||
test_vim_str2nr( '67890A', flags, {len = 5, num = 67890, unum = 67890, pre = 0}, 0)
|
test_vim_str2nr( '67890A', flags, {len = 0}, 0)
|
||||||
|
test_vim_str2nr( '12345A', flags, {len = 5, num = 12345, unum = 12345, pre = 0}, 0, false)
|
||||||
|
test_vim_str2nr( '67890A', flags, {len = 5, num = 67890, unum = 67890, pre = 0}, 0, false)
|
||||||
|
|
||||||
test_vim_str2nr( '42', flags, {len = 2, num = 42, unum = 42, pre = 0}, 0)
|
test_vim_str2nr( '42', flags, {len = 2, num = 42, unum = 42, pre = 0}, 0)
|
||||||
test_vim_str2nr( '42', flags, {len = 1, num = 4, unum = 4, pre = 0}, 1)
|
test_vim_str2nr( '42', flags, {len = 1, num = 4, unum = 4, pre = 0}, 1)
|
||||||
test_vim_str2nr( '42', flags, {len = 2, num = 42, unum = 42, pre = 0}, 2)
|
test_vim_str2nr( '42', flags, {len = 2, num = 42, unum = 42, pre = 0}, 2)
|
||||||
test_vim_str2nr( '42', flags, {len = 2, num = 42, unum = 42, pre = 0}, 3) -- includes NUL byte in maxlen
|
test_vim_str2nr( '42', flags, {len = 2, num = 42, unum = 42, pre = 0}, 3) -- includes NUL byte in maxlen
|
||||||
|
|
||||||
test_vim_str2nr( '42x', flags, {len = 2, num = 42, unum = 42, pre = 0}, 0)
|
test_vim_str2nr( '42x', flags, {len = 0}, 0)
|
||||||
test_vim_str2nr( '42x', flags, {len = 2, num = 42, unum = 42, pre = 0}, 3)
|
test_vim_str2nr( '42x', flags, {len = 0}, 3)
|
||||||
|
test_vim_str2nr( '42x', flags, {len = 2, num = 42, unum = 42, pre = 0}, 0, false)
|
||||||
|
test_vim_str2nr( '42x', flags, {len = 2, num = 42, unum = 42, pre = 0}, 3, false)
|
||||||
|
|
||||||
test_vim_str2nr('-42', flags, {len = 3, num = -42, unum = 42, pre = 0}, 3)
|
test_vim_str2nr('-42', flags, {len = 3, num = -42, unum = 42, pre = 0}, 3)
|
||||||
test_vim_str2nr('-42', flags, {len = 1, num = 0, unum = 0, pre = 0}, 1)
|
test_vim_str2nr('-42', flags, {len = 1, num = 0, unum = 0, pre = 0}, 1)
|
||||||
|
|
||||||
test_vim_str2nr('-42x', flags, {len = 3, num = -42, unum = 42, pre = 0}, 0)
|
test_vim_str2nr('-42x', flags, {len = 0}, 0)
|
||||||
test_vim_str2nr('-42x', flags, {len = 3, num = -42, unum = 42, pre = 0}, 4)
|
test_vim_str2nr('-42x', flags, {len = 0}, 4)
|
||||||
|
test_vim_str2nr('-42x', flags, {len = 3, num = -42, unum = 42, pre = 0}, 0, false)
|
||||||
|
test_vim_str2nr('-42x', flags, {len = 3, num = -42, unum = 42, pre = 0}, 4, false)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
itp('works with binary numbers', function()
|
itp('works with binary numbers', function()
|
||||||
@ -144,49 +151,61 @@ describe('vim_str2nr()', function()
|
|||||||
|
|
||||||
test_vim_str2nr( '0b101', flags, {len = 5, num = 5, unum = 5, pre = bin}, 0)
|
test_vim_str2nr( '0b101', flags, {len = 5, num = 5, unum = 5, pre = bin}, 0)
|
||||||
test_vim_str2nr( '0b101', flags, {len = 1, num = 0, unum = 0, pre = 0 }, 1)
|
test_vim_str2nr( '0b101', flags, {len = 1, num = 0, unum = 0, pre = 0 }, 1)
|
||||||
test_vim_str2nr( '0b101', flags, {len = 1, num = 0, unum = 0, pre = 0 }, 2)
|
test_vim_str2nr( '0b101', flags, {len = 0}, 2)
|
||||||
|
test_vim_str2nr( '0b101', flags, {len = 1, num = 0, unum = 0, pre = 0 }, 2, false)
|
||||||
test_vim_str2nr( '0b101', flags, {len = 3, num = 1, unum = 1, pre = bin}, 3)
|
test_vim_str2nr( '0b101', flags, {len = 3, num = 1, unum = 1, pre = bin}, 3)
|
||||||
test_vim_str2nr( '0b101', flags, {len = 4, num = 2, unum = 2, pre = bin}, 4)
|
test_vim_str2nr( '0b101', flags, {len = 4, num = 2, unum = 2, pre = bin}, 4)
|
||||||
test_vim_str2nr( '0b101', flags, {len = 5, num = 5, unum = 5, pre = bin}, 5)
|
test_vim_str2nr( '0b101', flags, {len = 5, num = 5, unum = 5, pre = bin}, 5)
|
||||||
test_vim_str2nr( '0b101', flags, {len = 5, num = 5, unum = 5, pre = bin}, 6)
|
test_vim_str2nr( '0b101', flags, {len = 5, num = 5, unum = 5, pre = bin}, 6)
|
||||||
|
|
||||||
test_vim_str2nr( '0b1012', flags, {len = 5, num = 5, unum = 5, pre = bin}, 0)
|
test_vim_str2nr( '0b1012', flags, {len = 0}, 0)
|
||||||
test_vim_str2nr( '0b1012', flags, {len = 5, num = 5, unum = 5, pre = bin}, 6)
|
test_vim_str2nr( '0b1012', flags, {len = 0}, 6)
|
||||||
|
test_vim_str2nr( '0b1012', flags, {len = 5, num = 5, unum = 5, pre = bin}, 0, false)
|
||||||
|
test_vim_str2nr( '0b1012', flags, {len = 5, num = 5, unum = 5, pre = bin}, 6, false)
|
||||||
|
|
||||||
test_vim_str2nr('-0b101', flags, {len = 6, num = -5, unum = 5, pre = bin}, 0)
|
test_vim_str2nr('-0b101', flags, {len = 6, num = -5, unum = 5, pre = bin}, 0)
|
||||||
test_vim_str2nr('-0b101', flags, {len = 1, num = 0, unum = 0, pre = 0 }, 1)
|
test_vim_str2nr('-0b101', flags, {len = 1, num = 0, unum = 0, pre = 0 }, 1)
|
||||||
test_vim_str2nr('-0b101', flags, {len = 2, num = 0, unum = 0, pre = 0 }, 2)
|
test_vim_str2nr('-0b101', flags, {len = 2, num = 0, unum = 0, pre = 0 }, 2)
|
||||||
test_vim_str2nr('-0b101', flags, {len = 2, num = 0, unum = 0, pre = 0 }, 3)
|
test_vim_str2nr('-0b101', flags, {len = 0}, 3)
|
||||||
|
test_vim_str2nr('-0b101', flags, {len = 2, num = 0, unum = 0, pre = 0 }, 3, false)
|
||||||
test_vim_str2nr('-0b101', flags, {len = 4, num = -1, unum = 1, pre = bin}, 4)
|
test_vim_str2nr('-0b101', flags, {len = 4, num = -1, unum = 1, pre = bin}, 4)
|
||||||
test_vim_str2nr('-0b101', flags, {len = 5, num = -2, unum = 2, pre = bin}, 5)
|
test_vim_str2nr('-0b101', flags, {len = 5, num = -2, unum = 2, pre = bin}, 5)
|
||||||
test_vim_str2nr('-0b101', flags, {len = 6, num = -5, unum = 5, pre = bin}, 6)
|
test_vim_str2nr('-0b101', flags, {len = 6, num = -5, unum = 5, pre = bin}, 6)
|
||||||
test_vim_str2nr('-0b101', flags, {len = 6, num = -5, unum = 5, pre = bin}, 7)
|
test_vim_str2nr('-0b101', flags, {len = 6, num = -5, unum = 5, pre = bin}, 7)
|
||||||
|
|
||||||
test_vim_str2nr('-0b1012', flags, {len = 6, num = -5, unum = 5, pre = bin}, 0)
|
test_vim_str2nr('-0b1012', flags, {len = 0}, 0)
|
||||||
test_vim_str2nr('-0b1012', flags, {len = 6, num = -5, unum = 5, pre = bin}, 7)
|
test_vim_str2nr('-0b1012', flags, {len = 0}, 7)
|
||||||
|
test_vim_str2nr('-0b1012', flags, {len = 6, num = -5, unum = 5, pre = bin}, 0, false)
|
||||||
|
test_vim_str2nr('-0b1012', flags, {len = 6, num = -5, unum = 5, pre = bin}, 7, false)
|
||||||
|
|
||||||
test_vim_str2nr( '0B101', flags, {len = 5, num = 5, unum = 5, pre = BIN}, 0)
|
test_vim_str2nr( '0B101', flags, {len = 5, num = 5, unum = 5, pre = BIN}, 0)
|
||||||
test_vim_str2nr( '0B101', flags, {len = 1, num = 0, unum = 0, pre = 0 }, 1)
|
test_vim_str2nr( '0B101', flags, {len = 1, num = 0, unum = 0, pre = 0 }, 1)
|
||||||
test_vim_str2nr( '0B101', flags, {len = 1, num = 0, unum = 0, pre = 0 }, 2)
|
test_vim_str2nr( '0B101', flags, {len = 0}, 2)
|
||||||
|
test_vim_str2nr( '0B101', flags, {len = 1, num = 0, unum = 0, pre = 0 }, 2, false)
|
||||||
test_vim_str2nr( '0B101', flags, {len = 3, num = 1, unum = 1, pre = BIN}, 3)
|
test_vim_str2nr( '0B101', flags, {len = 3, num = 1, unum = 1, pre = BIN}, 3)
|
||||||
test_vim_str2nr( '0B101', flags, {len = 4, num = 2, unum = 2, pre = BIN}, 4)
|
test_vim_str2nr( '0B101', flags, {len = 4, num = 2, unum = 2, pre = BIN}, 4)
|
||||||
test_vim_str2nr( '0B101', flags, {len = 5, num = 5, unum = 5, pre = BIN}, 5)
|
test_vim_str2nr( '0B101', flags, {len = 5, num = 5, unum = 5, pre = BIN}, 5)
|
||||||
test_vim_str2nr( '0B101', flags, {len = 5, num = 5, unum = 5, pre = BIN}, 6)
|
test_vim_str2nr( '0B101', flags, {len = 5, num = 5, unum = 5, pre = BIN}, 6)
|
||||||
|
|
||||||
test_vim_str2nr( '0B1012', flags, {len = 5, num = 5, unum = 5, pre = BIN}, 0)
|
test_vim_str2nr( '0B1012', flags, {len = 0}, 0)
|
||||||
test_vim_str2nr( '0B1012', flags, {len = 5, num = 5, unum = 5, pre = BIN}, 6)
|
test_vim_str2nr( '0B1012', flags, {len = 0}, 6)
|
||||||
|
test_vim_str2nr( '0B1012', flags, {len = 5, num = 5, unum = 5, pre = BIN}, 0, false)
|
||||||
|
test_vim_str2nr( '0B1012', flags, {len = 5, num = 5, unum = 5, pre = BIN}, 6, false)
|
||||||
|
|
||||||
test_vim_str2nr('-0B101', flags, {len = 6, num = -5, unum = 5, pre = BIN}, 0)
|
test_vim_str2nr('-0B101', flags, {len = 6, num = -5, unum = 5, pre = BIN}, 0)
|
||||||
test_vim_str2nr('-0B101', flags, {len = 1, num = 0, unum = 0, pre = 0 }, 1)
|
test_vim_str2nr('-0B101', flags, {len = 1, num = 0, unum = 0, pre = 0 }, 1)
|
||||||
test_vim_str2nr('-0B101', flags, {len = 2, num = 0, unum = 0, pre = 0 }, 2)
|
test_vim_str2nr('-0B101', flags, {len = 2, num = 0, unum = 0, pre = 0 }, 2)
|
||||||
test_vim_str2nr('-0B101', flags, {len = 2, num = 0, unum = 0, pre = 0 }, 3)
|
test_vim_str2nr('-0B101', flags, {len = 0}, 3)
|
||||||
|
test_vim_str2nr('-0B101', flags, {len = 2, num = 0, unum = 0, pre = 0 }, 3, false)
|
||||||
test_vim_str2nr('-0B101', flags, {len = 4, num = -1, unum = 1, pre = BIN}, 4)
|
test_vim_str2nr('-0B101', flags, {len = 4, num = -1, unum = 1, pre = BIN}, 4)
|
||||||
test_vim_str2nr('-0B101', flags, {len = 5, num = -2, unum = 2, pre = BIN}, 5)
|
test_vim_str2nr('-0B101', flags, {len = 5, num = -2, unum = 2, pre = BIN}, 5)
|
||||||
test_vim_str2nr('-0B101', flags, {len = 6, num = -5, unum = 5, pre = BIN}, 6)
|
test_vim_str2nr('-0B101', flags, {len = 6, num = -5, unum = 5, pre = BIN}, 6)
|
||||||
test_vim_str2nr('-0B101', flags, {len = 6, num = -5, unum = 5, pre = BIN}, 7)
|
test_vim_str2nr('-0B101', flags, {len = 6, num = -5, unum = 5, pre = BIN}, 7)
|
||||||
|
|
||||||
test_vim_str2nr('-0B1012', flags, {len = 6, num = -5, unum = 5, pre = BIN}, 0)
|
test_vim_str2nr('-0B1012', flags, {len = 0}, 0)
|
||||||
test_vim_str2nr('-0B1012', flags, {len = 6, num = -5, unum = 5, pre = BIN}, 7)
|
test_vim_str2nr('-0B1012', flags, {len = 0}, 7)
|
||||||
|
test_vim_str2nr('-0B1012', flags, {len = 6, num = -5, unum = 5, pre = BIN}, 0, false)
|
||||||
|
test_vim_str2nr('-0B1012', flags, {len = 6, num = -5, unum = 5, pre = BIN}, 7, false)
|
||||||
|
|
||||||
if flags > lib.STR2NR_FORCE then
|
if flags > lib.STR2NR_FORCE then
|
||||||
test_vim_str2nr('-101', flags, {len = 4, num = -5, unum = 5, pre = 0}, 0)
|
test_vim_str2nr('-101', flags, {len = 4, num = -5, unum = 5, pre = 0}, 0)
|
||||||
@ -218,8 +237,10 @@ describe('vim_str2nr()', function()
|
|||||||
test_vim_str2nr( '0548', flags, {len = 3, num = 44, unum = 44, pre = oct}, 3)
|
test_vim_str2nr( '0548', flags, {len = 3, num = 44, unum = 44, pre = oct}, 3)
|
||||||
test_vim_str2nr( '054', flags, {len = 3, num = 44, unum = 44, pre = oct}, 4)
|
test_vim_str2nr( '054', flags, {len = 3, num = 44, unum = 44, pre = oct}, 4)
|
||||||
|
|
||||||
test_vim_str2nr( '054x', flags, {len = 3, num = 44, unum = 44, pre = oct}, 4)
|
test_vim_str2nr( '054x', flags, {len = 0}, 4)
|
||||||
test_vim_str2nr( '054x', flags, {len = 3, num = 44, unum = 44, pre = oct}, 0)
|
test_vim_str2nr( '054x', flags, {len = 0}, 0)
|
||||||
|
test_vim_str2nr( '054x', flags, {len = 3, num = 44, unum = 44, pre = oct}, 4, false)
|
||||||
|
test_vim_str2nr( '054x', flags, {len = 3, num = 44, unum = 44, pre = oct}, 0, false)
|
||||||
|
|
||||||
test_vim_str2nr('-054', flags, {len = 4, num = -44, unum = 44, pre = oct}, 0)
|
test_vim_str2nr('-054', flags, {len = 4, num = -44, unum = 44, pre = oct}, 0)
|
||||||
test_vim_str2nr('-054', flags, {len = 1, num = 0, unum = 0, pre = 0 }, 1)
|
test_vim_str2nr('-054', flags, {len = 1, num = 0, unum = 0, pre = 0 }, 1)
|
||||||
@ -229,13 +250,17 @@ describe('vim_str2nr()', function()
|
|||||||
test_vim_str2nr('-0548', flags, {len = 4, num = -44, unum = 44, pre = oct}, 4)
|
test_vim_str2nr('-0548', flags, {len = 4, num = -44, unum = 44, pre = oct}, 4)
|
||||||
test_vim_str2nr('-054', flags, {len = 4, num = -44, unum = 44, pre = oct}, 5)
|
test_vim_str2nr('-054', flags, {len = 4, num = -44, unum = 44, pre = oct}, 5)
|
||||||
|
|
||||||
test_vim_str2nr('-054x', flags, {len = 4, num = -44, unum = 44, pre = oct}, 5)
|
test_vim_str2nr('-054x', flags, {len = 0}, 5)
|
||||||
test_vim_str2nr('-054x', flags, {len = 4, num = -44, unum = 44, pre = oct}, 0)
|
test_vim_str2nr('-054x', flags, {len = 0}, 0)
|
||||||
|
test_vim_str2nr('-054x', flags, {len = 4, num = -44, unum = 44, pre = oct}, 5, false)
|
||||||
|
test_vim_str2nr('-054x', flags, {len = 4, num = -44, unum = 44, pre = oct}, 0, false)
|
||||||
|
|
||||||
if flags > lib.STR2NR_FORCE then
|
if flags > lib.STR2NR_FORCE then
|
||||||
test_vim_str2nr('-54', flags, {len = 3, num = -44, unum = 44, pre = 0}, 0)
|
test_vim_str2nr('-54', flags, {len = 3, num = -44, unum = 44, pre = 0}, 0)
|
||||||
test_vim_str2nr('-0548', flags, {len = 4, num = -44, unum = 44, pre = 0}, 5)
|
test_vim_str2nr('-0548', flags, {len = 0}, 5)
|
||||||
test_vim_str2nr('-0548', flags, {len = 4, num = -44, unum = 44, pre = 0}, 0)
|
test_vim_str2nr('-0548', flags, {len = 0}, 0)
|
||||||
|
test_vim_str2nr('-0548', flags, {len = 4, num = -44, unum = 44, pre = 0}, 5, false)
|
||||||
|
test_vim_str2nr('-0548', flags, {len = 4, num = -44, unum = 44, pre = 0}, 0, false)
|
||||||
else
|
else
|
||||||
test_vim_str2nr('-0548', flags, {len = 5, num = -548, unum = 548, pre = 0}, 5)
|
test_vim_str2nr('-0548', flags, {len = 5, num = -548, unum = 548, pre = 0}, 5)
|
||||||
test_vim_str2nr('-0548', flags, {len = 5, num = -548, unum = 548, pre = 0}, 0)
|
test_vim_str2nr('-0548', flags, {len = 5, num = -548, unum = 548, pre = 0}, 0)
|
||||||
@ -268,49 +293,61 @@ describe('vim_str2nr()', function()
|
|||||||
|
|
||||||
test_vim_str2nr( '0x101', flags, {len = 5, num = 257, unum =257, pre = hex}, 0)
|
test_vim_str2nr( '0x101', flags, {len = 5, num = 257, unum =257, pre = hex}, 0)
|
||||||
test_vim_str2nr( '0x101', flags, {len = 1, num = 0, unum = 0, pre = 0 }, 1)
|
test_vim_str2nr( '0x101', flags, {len = 1, num = 0, unum = 0, pre = 0 }, 1)
|
||||||
test_vim_str2nr( '0x101', flags, {len = 1, num = 0, unum = 0, pre = 0 }, 2)
|
test_vim_str2nr( '0x101', flags, {len = 0}, 2)
|
||||||
|
test_vim_str2nr( '0x101', flags, {len = 1, num = 0, unum = 0, pre = 0 }, 2, false)
|
||||||
test_vim_str2nr( '0x101', flags, {len = 3, num = 1, unum = 1, pre = hex}, 3)
|
test_vim_str2nr( '0x101', flags, {len = 3, num = 1, unum = 1, pre = hex}, 3)
|
||||||
test_vim_str2nr( '0x101', flags, {len = 4, num = 16, unum = 16, pre = hex}, 4)
|
test_vim_str2nr( '0x101', flags, {len = 4, num = 16, unum = 16, pre = hex}, 4)
|
||||||
test_vim_str2nr( '0x101', flags, {len = 5, num = 257, unum =257, pre = hex}, 5)
|
test_vim_str2nr( '0x101', flags, {len = 5, num = 257, unum =257, pre = hex}, 5)
|
||||||
test_vim_str2nr( '0x101', flags, {len = 5, num = 257, unum =257, pre = hex}, 6)
|
test_vim_str2nr( '0x101', flags, {len = 5, num = 257, unum =257, pre = hex}, 6)
|
||||||
|
|
||||||
test_vim_str2nr( '0x101G', flags, {len = 5, num = 257, unum =257, pre = hex}, 0)
|
test_vim_str2nr( '0x101G', flags, {len = 0}, 0)
|
||||||
test_vim_str2nr( '0x101G', flags, {len = 5, num = 257, unum =257, pre = hex}, 6)
|
test_vim_str2nr( '0x101G', flags, {len = 0}, 6)
|
||||||
|
test_vim_str2nr( '0x101G', flags, {len = 5, num = 257, unum =257, pre = hex}, 0, false)
|
||||||
|
test_vim_str2nr( '0x101G', flags, {len = 5, num = 257, unum =257, pre = hex}, 6, false)
|
||||||
|
|
||||||
test_vim_str2nr('-0x101', flags, {len = 6, num =-257, unum =257, pre = hex}, 0)
|
test_vim_str2nr('-0x101', flags, {len = 6, num =-257, unum =257, pre = hex}, 0)
|
||||||
test_vim_str2nr('-0x101', flags, {len = 1, num = 0, unum = 0, pre = 0 }, 1)
|
test_vim_str2nr('-0x101', flags, {len = 1, num = 0, unum = 0, pre = 0 }, 1)
|
||||||
test_vim_str2nr('-0x101', flags, {len = 2, num = 0, unum = 0, pre = 0 }, 2)
|
test_vim_str2nr('-0x101', flags, {len = 2, num = 0, unum = 0, pre = 0 }, 2)
|
||||||
test_vim_str2nr('-0x101', flags, {len = 2, num = 0, unum = 0, pre = 0 }, 3)
|
test_vim_str2nr('-0x101', flags, {len = 0}, 3)
|
||||||
|
test_vim_str2nr('-0x101', flags, {len = 2, num = 0, unum = 0, pre = 0 }, 3, false)
|
||||||
test_vim_str2nr('-0x101', flags, {len = 4, num = -1, unum = 1, pre = hex}, 4)
|
test_vim_str2nr('-0x101', flags, {len = 4, num = -1, unum = 1, pre = hex}, 4)
|
||||||
test_vim_str2nr('-0x101', flags, {len = 5, num = -16, unum = 16, pre = hex}, 5)
|
test_vim_str2nr('-0x101', flags, {len = 5, num = -16, unum = 16, pre = hex}, 5)
|
||||||
test_vim_str2nr('-0x101', flags, {len = 6, num =-257, unum =257, pre = hex}, 6)
|
test_vim_str2nr('-0x101', flags, {len = 6, num =-257, unum =257, pre = hex}, 6)
|
||||||
test_vim_str2nr('-0x101', flags, {len = 6, num =-257, unum =257, pre = hex}, 7)
|
test_vim_str2nr('-0x101', flags, {len = 6, num =-257, unum =257, pre = hex}, 7)
|
||||||
|
|
||||||
test_vim_str2nr('-0x101G', flags, {len = 6, num =-257, unum =257, pre = hex}, 0)
|
test_vim_str2nr('-0x101G', flags, {len = 0}, 0)
|
||||||
test_vim_str2nr('-0x101G', flags, {len = 6, num =-257, unum =257, pre = hex}, 7)
|
test_vim_str2nr('-0x101G', flags, {len = 0}, 7)
|
||||||
|
test_vim_str2nr('-0x101G', flags, {len = 6, num =-257, unum =257, pre = hex}, 0, false)
|
||||||
|
test_vim_str2nr('-0x101G', flags, {len = 6, num =-257, unum =257, pre = hex}, 7, false)
|
||||||
|
|
||||||
test_vim_str2nr( '0X101', flags, {len = 5, num = 257, unum =257, pre = HEX}, 0)
|
test_vim_str2nr( '0X101', flags, {len = 5, num = 257, unum =257, pre = HEX}, 0)
|
||||||
test_vim_str2nr( '0X101', flags, {len = 1, num = 0, unum = 0, pre = 0 }, 1)
|
test_vim_str2nr( '0X101', flags, {len = 1, num = 0, unum = 0, pre = 0 }, 1)
|
||||||
test_vim_str2nr( '0X101', flags, {len = 1, num = 0, unum = 0, pre = 0 }, 2)
|
test_vim_str2nr( '0X101', flags, {len = 0}, 2)
|
||||||
|
test_vim_str2nr( '0X101', flags, {len = 1, num = 0, unum = 0, pre = 0 }, 2, false)
|
||||||
test_vim_str2nr( '0X101', flags, {len = 3, num = 1, unum = 1, pre = HEX}, 3)
|
test_vim_str2nr( '0X101', flags, {len = 3, num = 1, unum = 1, pre = HEX}, 3)
|
||||||
test_vim_str2nr( '0X101', flags, {len = 4, num = 16, unum = 16, pre = HEX}, 4)
|
test_vim_str2nr( '0X101', flags, {len = 4, num = 16, unum = 16, pre = HEX}, 4)
|
||||||
test_vim_str2nr( '0X101', flags, {len = 5, num = 257, unum =257, pre = HEX}, 5)
|
test_vim_str2nr( '0X101', flags, {len = 5, num = 257, unum =257, pre = HEX}, 5)
|
||||||
test_vim_str2nr( '0X101', flags, {len = 5, num = 257, unum =257, pre = HEX}, 6)
|
test_vim_str2nr( '0X101', flags, {len = 5, num = 257, unum =257, pre = HEX}, 6)
|
||||||
|
|
||||||
test_vim_str2nr( '0X101G', flags, {len = 5, num = 257, unum =257, pre = HEX}, 0)
|
test_vim_str2nr( '0X101G', flags, {len = 0}, 0)
|
||||||
test_vim_str2nr( '0X101G', flags, {len = 5, num = 257, unum =257, pre = HEX}, 6)
|
test_vim_str2nr( '0X101G', flags, {len = 0}, 6)
|
||||||
|
test_vim_str2nr( '0X101G', flags, {len = 5, num = 257, unum =257, pre = HEX}, 0, false)
|
||||||
|
test_vim_str2nr( '0X101G', flags, {len = 5, num = 257, unum =257, pre = HEX}, 6, false)
|
||||||
|
|
||||||
test_vim_str2nr('-0X101', flags, {len = 6, num =-257, unum =257, pre = HEX}, 0)
|
test_vim_str2nr('-0X101', flags, {len = 6, num =-257, unum =257, pre = HEX}, 0)
|
||||||
test_vim_str2nr('-0X101', flags, {len = 1, num = 0, unum = 0, pre = 0 }, 1)
|
test_vim_str2nr('-0X101', flags, {len = 1, num = 0, unum = 0, pre = 0 }, 1)
|
||||||
test_vim_str2nr('-0X101', flags, {len = 2, num = 0, unum = 0, pre = 0 }, 2)
|
test_vim_str2nr('-0X101', flags, {len = 2, num = 0, unum = 0, pre = 0 }, 2)
|
||||||
test_vim_str2nr('-0X101', flags, {len = 2, num = 0, unum = 0, pre = 0 }, 3)
|
test_vim_str2nr('-0X101', flags, {len = 0}, 3)
|
||||||
|
test_vim_str2nr('-0X101', flags, {len = 2, num = 0, unum = 0, pre = 0 }, 3, false)
|
||||||
test_vim_str2nr('-0X101', flags, {len = 4, num = -1, unum = 1, pre = HEX}, 4)
|
test_vim_str2nr('-0X101', flags, {len = 4, num = -1, unum = 1, pre = HEX}, 4)
|
||||||
test_vim_str2nr('-0X101', flags, {len = 5, num = -16, unum = 16, pre = HEX}, 5)
|
test_vim_str2nr('-0X101', flags, {len = 5, num = -16, unum = 16, pre = HEX}, 5)
|
||||||
test_vim_str2nr('-0X101', flags, {len = 6, num =-257, unum =257, pre = HEX}, 6)
|
test_vim_str2nr('-0X101', flags, {len = 6, num =-257, unum =257, pre = HEX}, 6)
|
||||||
test_vim_str2nr('-0X101', flags, {len = 6, num =-257, unum =257, pre = HEX}, 7)
|
test_vim_str2nr('-0X101', flags, {len = 6, num =-257, unum =257, pre = HEX}, 7)
|
||||||
|
|
||||||
test_vim_str2nr('-0X101G', flags, {len = 6, num =-257, unum =257, pre = HEX}, 0)
|
test_vim_str2nr('-0X101G', flags, {len = 0}, 0)
|
||||||
test_vim_str2nr('-0X101G', flags, {len = 6, num =-257, unum =257, pre = HEX}, 7)
|
test_vim_str2nr('-0X101G', flags, {len = 0}, 7)
|
||||||
|
test_vim_str2nr('-0X101G', flags, {len = 6, num =-257, unum =257, pre = HEX}, 0, false)
|
||||||
|
test_vim_str2nr('-0X101G', flags, {len = 6, num =-257, unum =257, pre = HEX}, 7, false)
|
||||||
|
|
||||||
if flags > lib.STR2NR_FORCE then
|
if flags > lib.STR2NR_FORCE then
|
||||||
test_vim_str2nr('-101', flags, {len = 4, num = -257, unum = 257, pre = 0}, 0)
|
test_vim_str2nr('-101', flags, {len = 4, num = -257, unum = 257, pre = 0}, 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user