mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.2.3186: Vim9: not all failures for import tested
Problem: Vim9: not all failures for import tested Solution: Test more import failures
This commit is contained in:
parent
ac2cd2b08f
commit
605793500b
@ -511,7 +511,7 @@ EXTERN char e_list_required_for_argument_nr[]
|
|||||||
EXTERN char e_bool_required_for_argument_nr[]
|
EXTERN char e_bool_required_for_argument_nr[]
|
||||||
INIT(= N_("E1212: Bool required for argument %d"));
|
INIT(= N_("E1212: Bool required for argument %d"));
|
||||||
EXTERN char e_redefining_imported_item_str[]
|
EXTERN char e_redefining_imported_item_str[]
|
||||||
INIT(= N_("E1213: Redefining imported item %s"));
|
INIT(= N_("E1213: Redefining imported item \"%s\""));
|
||||||
#if defined(FEAT_DIGRAPHS) && defined(FEAT_EVAL)
|
#if defined(FEAT_DIGRAPHS) && defined(FEAT_EVAL)
|
||||||
EXTERN char e_digraph_must_be_just_two_characters_str[]
|
EXTERN char e_digraph_must_be_just_two_characters_str[]
|
||||||
INIT(= N_("E1214: Digraph must be just two characters: %s"));
|
INIT(= N_("E1214: Digraph must be just two characters: %s"));
|
||||||
|
@ -3250,6 +3250,7 @@ set_var_const(
|
|||||||
{
|
{
|
||||||
scriptitem_T *si = SCRIPT_ITEM(import->imp_sid);
|
scriptitem_T *si = SCRIPT_ITEM(import->imp_sid);
|
||||||
svar_T *sv;
|
svar_T *sv;
|
||||||
|
where_T where;
|
||||||
|
|
||||||
// imported variable from another script
|
// imported variable from another script
|
||||||
if ((flags & ASSIGN_NO_DECL) == 0)
|
if ((flags & ASSIGN_NO_DECL) == 0)
|
||||||
@ -3257,10 +3258,16 @@ set_var_const(
|
|||||||
semsg(_(e_redefining_imported_item_str), name);
|
semsg(_(e_redefining_imported_item_str), name);
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
sv = ((svar_T *)si->sn_var_vals.ga_data)
|
sv = ((svar_T *)si->sn_var_vals.ga_data) + import->imp_var_vals_idx;
|
||||||
+ import->imp_var_vals_idx;
|
|
||||||
// TODO: check the type
|
where.wt_index = 0;
|
||||||
// TODO: check for const and locked
|
where.wt_variable = TRUE;
|
||||||
|
if (check_typval_type(sv->sv_type, tv, where) == FAIL
|
||||||
|
|| value_check_lock(sv->sv_tv->v_lock, name, FALSE))
|
||||||
|
{
|
||||||
|
goto failed;
|
||||||
|
}
|
||||||
|
|
||||||
dest_tv = sv->sv_tv;
|
dest_tv = sv->sv_tv;
|
||||||
clear_tv(dest_tv);
|
clear_tv(dest_tv);
|
||||||
}
|
}
|
||||||
|
@ -1375,6 +1375,30 @@ def Test_vim9_import_export()
|
|||||||
writefile(import_missing_comma_lines, 'Ximport3.vim')
|
writefile(import_missing_comma_lines, 'Ximport3.vim')
|
||||||
assert_fails('source Ximport3.vim', 'E1046:', '', 2, 'Ximport3.vim')
|
assert_fails('source Ximport3.vim', 'E1046:', '', 2, 'Ximport3.vim')
|
||||||
|
|
||||||
|
var import_redefining_lines =<< trim END
|
||||||
|
vim9script
|
||||||
|
import exported from './Xexport.vim'
|
||||||
|
var exported = 5
|
||||||
|
END
|
||||||
|
writefile(import_redefining_lines, 'Ximport.vim')
|
||||||
|
assert_fails('source Ximport.vim', 'E1213: Redefining imported item "exported"', '', 3)
|
||||||
|
|
||||||
|
var import_assign_wrong_type_lines =<< trim END
|
||||||
|
vim9script
|
||||||
|
import exported from './Xexport.vim'
|
||||||
|
exported = 'xxx'
|
||||||
|
END
|
||||||
|
writefile(import_assign_wrong_type_lines, 'Ximport.vim')
|
||||||
|
assert_fails('source Ximport.vim', 'E1012: Type mismatch; expected number but got string', '', 3)
|
||||||
|
|
||||||
|
var import_assign_const_lines =<< trim END
|
||||||
|
vim9script
|
||||||
|
import CONST from './Xexport.vim'
|
||||||
|
CONST = 4321
|
||||||
|
END
|
||||||
|
writefile(import_assign_const_lines, 'Ximport.vim')
|
||||||
|
assert_fails('source Ximport.vim', 'E741: Value is locked: CONST', '', 3)
|
||||||
|
|
||||||
delete('Ximport.vim')
|
delete('Ximport.vim')
|
||||||
delete('Ximport3.vim')
|
delete('Ximport3.vim')
|
||||||
delete('Xexport.vim')
|
delete('Xexport.vim')
|
||||||
|
@ -755,6 +755,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
3186,
|
||||||
/**/
|
/**/
|
||||||
3185,
|
3185,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user