mirror of
https://github.com/macvim-dev/macvim.git
synced 2026-06-07 15:37:14 +02:00
Merge remote-tracking branch 'vim/master'
This commit is contained in:
+21
-6
@@ -1,4 +1,4 @@
|
||||
*eval.txt* For Vim version 7.4. Last change: 2016 Jan 15
|
||||
*eval.txt* For Vim version 7.4. Last change: 2016 Jan 16
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -919,6 +919,11 @@ just above, except that indexes out of range cause an error. Examples: >
|
||||
Using expr8[expr1] or expr8[expr1a : expr1b] on a |Funcref| results in an
|
||||
error.
|
||||
|
||||
Watch out for confusion between a namespace and a variable followed by a colon
|
||||
for a sublist: >
|
||||
mylist[n:] " uses variable n
|
||||
mylist[s:] " uses namespace s:, error!
|
||||
|
||||
|
||||
expr8.name entry in a |Dictionary| *expr-entry*
|
||||
|
||||
@@ -1794,7 +1799,7 @@ cursor( {lnum}, {col} [, {off}])
|
||||
Number move cursor to {lnum}, {col}, {off}
|
||||
cursor( {list}) Number move cursor to position in {list}
|
||||
deepcopy( {expr} [, {noref}]) any make a full copy of {expr}
|
||||
delete( {fname}) Number delete file {fname}
|
||||
delete( {fname} [, {flags}]) Number delete the file or directory {fname}
|
||||
did_filetype() Number TRUE if FileType autocommand event used
|
||||
diff_filler( {lnum}) Number diff filler lines about {lnum}
|
||||
diff_hlID( {lnum}, {col}) Number diff highlighting at {lnum}/{col}
|
||||
@@ -2748,10 +2753,20 @@ deepcopy({expr}[, {noref}]) *deepcopy()* *E698*
|
||||
{noref} set to 1 will fail.
|
||||
Also see |copy()|.
|
||||
|
||||
delete({fname}) *delete()*
|
||||
Deletes the file by the name {fname}. The result is a Number,
|
||||
which is 0 if the file was deleted successfully, and non-zero
|
||||
when the deletion failed.
|
||||
delete({fname} [, {flags}]) *delete()*
|
||||
Without {flags} or with {flags} empty: Deletes the file by the
|
||||
name {fname}. This also works when {fname} is a symbolic link.
|
||||
|
||||
When {flags} is "d": Deletes the directory by the name
|
||||
{fname}. This fails when directory {fname} is not empty.
|
||||
|
||||
When {flags} is "rf": Deletes the directory by the name
|
||||
{fname} and everything in it, recursively. BE CAREFUL!
|
||||
A symbolic link itself is deleted, not what it points to.
|
||||
|
||||
The result is a Number, which is 0 if the delete operation was
|
||||
successful and -1 when the deletion failed or partly failed.
|
||||
|
||||
Use |remove()| to delete an item from a |List|.
|
||||
To delete a line from the buffer use |:delete|. Use |:exe|
|
||||
when the line number is in a variable.
|
||||
|
||||
+4
-1
@@ -1992,12 +1992,15 @@ test1 \
|
||||
test70 test71 test72 test73 test74 test75 test76 test77 test78 test79 \
|
||||
test80 test81 test82 test83 test84 test85 test86 test87 test88 test89 \
|
||||
test90 test91 test92 test93 test94 test95 test96 test97 test98 test99 \
|
||||
test100 test101 test102 test103 test104 test105 test106 test107:
|
||||
test100 test101 test102 test103 test104 test105 test106 test107 test108:
|
||||
cd testdir; rm -f $@.out; $(MAKE) -f Makefile $@.out VIMPROG=../$(VIMTARGET) $(GUI_TESTARG) SCRIPTSOURCE=../$(SCRIPTSOURCE)
|
||||
|
||||
test_assert \
|
||||
test_backspace_opt \
|
||||
test_cdo \
|
||||
test_cursor_func \
|
||||
test_delete \
|
||||
test_expand \
|
||||
test_hardcopy \
|
||||
test_increment \
|
||||
test_lispwords \
|
||||
|
||||
+32
-5
@@ -8132,7 +8132,7 @@ static struct fst
|
||||
{"cscope_connection",0,3, f_cscope_connection},
|
||||
{"cursor", 1, 3, f_cursor},
|
||||
{"deepcopy", 1, 2, f_deepcopy},
|
||||
{"delete", 1, 1, f_delete},
|
||||
{"delete", 1, 2, f_delete},
|
||||
{"did_filetype", 0, 0, f_did_filetype},
|
||||
{"diff_filler", 1, 1, f_diff_filler},
|
||||
{"diff_hlID", 2, 2, f_diff_hlID},
|
||||
@@ -10392,10 +10392,37 @@ f_delete(argvars, rettv)
|
||||
typval_T *argvars;
|
||||
typval_T *rettv;
|
||||
{
|
||||
char_u nbuf[NUMBUFLEN];
|
||||
char_u *name;
|
||||
char_u *flags;
|
||||
|
||||
rettv->vval.v_number = -1;
|
||||
if (check_restricted() || check_secure())
|
||||
rettv->vval.v_number = -1;
|
||||
return;
|
||||
|
||||
name = get_tv_string(&argvars[0]);
|
||||
if (name == NULL || *name == NUL)
|
||||
{
|
||||
EMSG(_(e_invarg));
|
||||
return;
|
||||
}
|
||||
|
||||
if (argvars[1].v_type != VAR_UNKNOWN)
|
||||
flags = get_tv_string_buf(&argvars[1], nbuf);
|
||||
else
|
||||
rettv->vval.v_number = mch_remove(get_tv_string(&argvars[0]));
|
||||
flags = (char_u *)"";
|
||||
|
||||
if (*flags == NUL)
|
||||
/* delete a file */
|
||||
rettv->vval.v_number = mch_remove(name) == 0 ? 0 : -1;
|
||||
else if (STRCMP(flags, "d") == 0)
|
||||
/* delete an empty directory */
|
||||
rettv->vval.v_number = mch_rmdir(name) == 0 ? 0 : -1;
|
||||
else if (STRCMP(flags, "rf") == 0)
|
||||
/* delete a directory recursively */
|
||||
rettv->vval.v_number = delete_recursive(name);
|
||||
else
|
||||
EMSG2(_(e_invexpr2), flags);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -20845,10 +20872,10 @@ find_name_end(arg, expr_start, expr_end, flags)
|
||||
else if (br_nest == 0 && mb_nest == 0 && *p == ':')
|
||||
{
|
||||
/* "s:" is start of "s:var", but "n:" is not and can be used in
|
||||
* slice "[n:]". Also "xx:" is not a namespace. */
|
||||
* slice "[n:]". Also "xx:" is not a namespace. But {ns}: is. */
|
||||
len = (int)(p - arg);
|
||||
if ((len == 1 && vim_strchr(NAMESPACE_CHAR, *arg) == NULL)
|
||||
|| len > 1)
|
||||
|| (len > 1 && p[-1] != '}'))
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
+5
-3
@@ -2220,9 +2220,7 @@ do_arglist(str, what, after)
|
||||
i = expand_wildcards(new_ga.ga_len, (char_u **)new_ga.ga_data,
|
||||
&exp_count, &exp_files, EW_DIR|EW_FILE|EW_ADDSLASH|EW_NOTFOUND);
|
||||
ga_clear(&new_ga);
|
||||
if (i == FAIL)
|
||||
return FAIL;
|
||||
if (exp_count == 0)
|
||||
if (i == FAIL || exp_count == 0)
|
||||
{
|
||||
EMSG(_(e_nomatch));
|
||||
return FAIL;
|
||||
@@ -2637,6 +2635,10 @@ ex_argdelete(eap)
|
||||
curwin->w_arg_idx -= n;
|
||||
else if (curwin->w_arg_idx > eap->line1)
|
||||
curwin->w_arg_idx = eap->line1;
|
||||
if (ARGCOUNT == 0)
|
||||
curwin->w_arg_idx = 0;
|
||||
else if (curwin->w_arg_idx >= ARGCOUNT)
|
||||
curwin->w_arg_idx = ARGCOUNT - 1;
|
||||
}
|
||||
}
|
||||
else if (*eap->arg == NUL)
|
||||
|
||||
+55
-17
@@ -7318,6 +7318,58 @@ write_lnum_adjust(offset)
|
||||
curbuf->b_no_eol_lnum += offset;
|
||||
}
|
||||
|
||||
#if defined(TEMPDIRNAMES) || defined(FEAT_EVAL) || defined(PROTO)
|
||||
/*
|
||||
* Delete "name" and everything in it, recursively.
|
||||
* return 0 for succes, -1 if some file was not deleted.
|
||||
*/
|
||||
int
|
||||
delete_recursive(char_u *name)
|
||||
{
|
||||
int result = 0;
|
||||
char_u **files;
|
||||
int file_count;
|
||||
int i;
|
||||
char_u *exp;
|
||||
|
||||
/* A symbolic link to a directory itself is deleted, not the directory it
|
||||
* points to. */
|
||||
if (
|
||||
# if defined(WIN32)
|
||||
mch_isdir(name) && !mch_is_symbolic_link(name)
|
||||
# else
|
||||
# ifdef UNIX
|
||||
mch_isrealdir(name)
|
||||
# else
|
||||
mch_isdir(name)
|
||||
# endif
|
||||
# endif
|
||||
)
|
||||
{
|
||||
vim_snprintf((char *)NameBuff, MAXPATHL, "%s/*", name);
|
||||
exp = vim_strsave(NameBuff);
|
||||
if (exp == NULL)
|
||||
return -1;
|
||||
if (gen_expand_wildcards(1, &exp, &file_count, &files,
|
||||
EW_DIR|EW_FILE|EW_SILENT|EW_ALLLINKS|EW_DODOT|EW_EMPTYOK) == OK)
|
||||
{
|
||||
for (i = 0; i < file_count; ++i)
|
||||
if (delete_recursive(files[i]) != 0)
|
||||
result = -1;
|
||||
FreeWild(file_count, files);
|
||||
}
|
||||
else
|
||||
result = -1;
|
||||
vim_free(exp);
|
||||
(void)mch_rmdir(name);
|
||||
}
|
||||
else
|
||||
result = mch_remove(name) == 0 ? 0 : -1;
|
||||
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(TEMPDIRNAMES) || defined(PROTO)
|
||||
static long temp_count = 0; /* Temp filename counter. */
|
||||
|
||||
@@ -7327,30 +7379,16 @@ static long temp_count = 0; /* Temp filename counter. */
|
||||
void
|
||||
vim_deltempdir()
|
||||
{
|
||||
char_u **files;
|
||||
int file_count;
|
||||
int i;
|
||||
|
||||
if (vim_tempdir != NULL)
|
||||
{
|
||||
sprintf((char *)NameBuff, "%s*", vim_tempdir);
|
||||
if (gen_expand_wildcards(1, &NameBuff, &file_count, &files,
|
||||
EW_DIR|EW_FILE|EW_SILENT) == OK)
|
||||
{
|
||||
for (i = 0; i < file_count; ++i)
|
||||
mch_remove(files[i]);
|
||||
FreeWild(file_count, files);
|
||||
}
|
||||
gettail(NameBuff)[-1] = NUL;
|
||||
(void)mch_rmdir(NameBuff);
|
||||
|
||||
/* remove the trailing path separator */
|
||||
gettail(vim_tempdir)[-1] = NUL;
|
||||
delete_recursive(vim_tempdir);
|
||||
vim_free(vim_tempdir);
|
||||
vim_tempdir = NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef TEMPDIRNAMES
|
||||
/*
|
||||
* Directory "tempdir" was created. Expand this name to a full path and put
|
||||
* it in "vim_tempdir". This avoids that using ":cd" would confuse us.
|
||||
|
||||
+10
-5
@@ -10019,7 +10019,7 @@ dos_expandpath(
|
||||
if (p[0] == '*' && p[1] == '*')
|
||||
starstar = TRUE;
|
||||
|
||||
starts_with_dot = (*s == '.');
|
||||
starts_with_dot = *s == '.';
|
||||
pat = file_pat_to_reg_pat(s, e, NULL, FALSE);
|
||||
if (pat == NULL)
|
||||
{
|
||||
@@ -10102,7 +10102,9 @@ dos_expandpath(
|
||||
#endif
|
||||
/* Ignore entries starting with a dot, unless when asked for. Accept
|
||||
* all entries found with "matchname". */
|
||||
if ((p[0] != '.' || starts_with_dot)
|
||||
if ((p[0] != '.' || starts_with_dot
|
||||
|| ((flags & EW_DODOT)
|
||||
&& p[1] != NUL && (p[1] != '.' || p[2] != NUL)))
|
||||
&& (matchname == NULL
|
||||
|| (regmatch.regprog != NULL
|
||||
&& vim_regexec(®match, p, (colnr_T)0))
|
||||
@@ -10331,7 +10333,7 @@ unix_expandpath(gap, path, wildoff, flags, didstar)
|
||||
starstar = TRUE;
|
||||
|
||||
/* convert the file pattern to a regexp pattern */
|
||||
starts_with_dot = (*s == '.');
|
||||
starts_with_dot = *s == '.';
|
||||
pat = file_pat_to_reg_pat(s, e, NULL, FALSE);
|
||||
if (pat == NULL)
|
||||
{
|
||||
@@ -10380,7 +10382,10 @@ unix_expandpath(gap, path, wildoff, flags, didstar)
|
||||
dp = readdir(dirp);
|
||||
if (dp == NULL)
|
||||
break;
|
||||
if ((dp->d_name[0] != '.' || starts_with_dot)
|
||||
if ((dp->d_name[0] != '.' || starts_with_dot
|
||||
|| ((flags & EW_DODOT)
|
||||
&& dp->d_name[1] != NUL
|
||||
&& (dp->d_name[1] != '.' || dp->d_name[2] != NUL)))
|
||||
&& ((regmatch.regprog != NULL && vim_regexec(®match,
|
||||
(char_u *)dp->d_name, (colnr_T)0))
|
||||
|| ((flags & EW_NOTWILD)
|
||||
@@ -11088,7 +11093,7 @@ gen_expand_wildcards(num_pat, pat, num_file, file, flags)
|
||||
|
||||
recursive = FALSE;
|
||||
|
||||
return (ga.ga_data != NULL) ? retval : FAIL;
|
||||
return ((flags & EW_EMPTYOK) || ga.ga_data != NULL) ? retval : FAIL;
|
||||
}
|
||||
|
||||
# ifdef VIM_BACKTICK
|
||||
|
||||
+1
-1
@@ -5549,7 +5549,7 @@ find_file_in_path_option(ptr, len, options, first, path_option,
|
||||
/* copy file name into NameBuff, expanding environment variables */
|
||||
save_char = ptr[len];
|
||||
ptr[len] = NUL;
|
||||
expand_env(ptr, NameBuff, MAXPATHL);
|
||||
expand_env_esc(ptr, NameBuff, MAXPATHL, FALSE, TRUE, NULL);
|
||||
ptr[len] = save_char;
|
||||
|
||||
vim_free(ff_file_to_find);
|
||||
|
||||
+23
-1
@@ -2996,7 +2996,7 @@ mch_hide(name)
|
||||
}
|
||||
|
||||
/*
|
||||
* return TRUE if "name" is a directory
|
||||
* return TRUE if "name" is a directory or a symlink to a directory
|
||||
* return FALSE if "name" is not a directory
|
||||
* return FALSE for error
|
||||
*/
|
||||
@@ -3017,6 +3017,28 @@ mch_isdir(name)
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* return TRUE if "name" is a directory, NOT a symlink to a directory
|
||||
* return FALSE if "name" is not a directory
|
||||
* return FALSE for error
|
||||
*/
|
||||
int
|
||||
mch_isrealdir(name)
|
||||
char_u *name;
|
||||
{
|
||||
struct stat statb;
|
||||
|
||||
if (*name == NUL) /* Some stat()s don't flag "" as an error. */
|
||||
return FALSE;
|
||||
if (lstat((char *)name, &statb))
|
||||
return FALSE;
|
||||
#ifdef _POSIX_SOURCE
|
||||
return (S_ISDIR(statb.st_mode) ? TRUE : FALSE);
|
||||
#else
|
||||
return ((statb.st_mode & S_IFMT) == S_IFDIR ? TRUE : FALSE);
|
||||
#endif
|
||||
}
|
||||
|
||||
static int executable_file __ARGS((char_u *name));
|
||||
|
||||
/*
|
||||
|
||||
@@ -3153,6 +3153,30 @@ mch_mkdir(char_u *name)
|
||||
return _mkdir(name);
|
||||
}
|
||||
|
||||
/*
|
||||
* Delete directory "name".
|
||||
* Return 0 on success, -1 on error.
|
||||
*/
|
||||
int
|
||||
mch_rmdir(char_u *name)
|
||||
{
|
||||
#ifdef FEAT_MBYTE
|
||||
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||
{
|
||||
WCHAR *p;
|
||||
int retval;
|
||||
|
||||
p = enc_to_utf16(name, NULL);
|
||||
if (p == NULL)
|
||||
return -1;
|
||||
retval = _wrmdir(p);
|
||||
vim_free(p);
|
||||
return retval;
|
||||
}
|
||||
#endif
|
||||
return _rmdir(name);
|
||||
}
|
||||
|
||||
/*
|
||||
* Return TRUE if file "fname" has more than one link.
|
||||
*/
|
||||
|
||||
@@ -22,6 +22,7 @@ int buf_check_timestamp __ARGS((buf_T *buf, int focus));
|
||||
void buf_reload __ARGS((buf_T *buf, int orig_mode));
|
||||
void buf_store_time __ARGS((buf_T *buf, struct stat *st, char_u *fname));
|
||||
void write_lnum_adjust __ARGS((linenr_T offset));
|
||||
int delete_recursive __ARGS((char_u *name));
|
||||
void vim_deltempdir __ARGS((void));
|
||||
char_u *vim_tempname __ARGS((int extra_char, int keep));
|
||||
void forward_slash __ARGS((char_u *fname));
|
||||
|
||||
@@ -41,6 +41,7 @@ void mch_set_acl __ARGS((char_u *fname, vim_acl_T aclent));
|
||||
void mch_free_acl __ARGS((vim_acl_T aclent));
|
||||
void mch_hide __ARGS((char_u *name));
|
||||
int mch_isdir __ARGS((char_u *name));
|
||||
int mch_isrealdir __ARGS((char_u *name));
|
||||
int mch_can_exe __ARGS((char_u *name, char_u **path, int use_path));
|
||||
int mch_nodetype __ARGS((char_u *name));
|
||||
void mch_early_init __ARGS((void));
|
||||
|
||||
@@ -22,6 +22,7 @@ void mch_hide __ARGS((char_u *name));
|
||||
int mch_ishidden __ARGS((char_u *name));
|
||||
int mch_isdir __ARGS((char_u *name));
|
||||
int mch_mkdir __ARGS((char_u *name));
|
||||
int mch_rmdir __ARGS((char_u *name));
|
||||
int mch_is_hard_link __ARGS((char_u *fname));
|
||||
int mch_is_symbolic_link __ARGS((char_u *fname));
|
||||
int mch_is_linked __ARGS((char_u *fname));
|
||||
|
||||
@@ -139,7 +139,6 @@ SCRIPTS_MORE2 = \
|
||||
test10.out \
|
||||
test12.out \
|
||||
test25.out \
|
||||
test27.out \
|
||||
test49.out \
|
||||
test97.out
|
||||
|
||||
@@ -172,7 +171,8 @@ SCRIPTS_GUI = test16.out
|
||||
|
||||
# Tests using runtest.vim.vim.
|
||||
# Keep test_alot.res as the last one, sort the others.
|
||||
NEW_TESTS = test_assert.res \
|
||||
NEW_TESTS = test_arglist.res \
|
||||
test_assert.res \
|
||||
test_cdo.res \
|
||||
test_hardcopy.res \
|
||||
test_increment.res \
|
||||
|
||||
@@ -15,7 +15,6 @@ include Make_all.mak
|
||||
# test11 "cat" doesn't work properly
|
||||
# test12 can't unlink a swap file
|
||||
# test25 uses symbolic link
|
||||
# test27 can't edit file with "*"
|
||||
# test52 only for Win32
|
||||
# test85 no Lua interface
|
||||
# test86, 87 no Python interface
|
||||
|
||||
@@ -14,7 +14,6 @@ default: nongui
|
||||
# test10 'errorformat' is different
|
||||
# test12 can't unlink a swap file
|
||||
# test25 uses symbolic link
|
||||
# test27 can't edit file with "*" in file name
|
||||
# test49 fails in various ways
|
||||
# test97 \{ and \$ are not escaped characters.
|
||||
|
||||
@@ -39,7 +38,7 @@ win32: nolog $(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_WIN32) newtests report
|
||||
$(DOSTMP_INFILES): $(*B).in
|
||||
if not exist $(DOSTMP)\NUL md $(DOSTMP)
|
||||
if exist $@ del $@
|
||||
$(VIMPROG) -u dos.vim --noplugin "+set ff=dos|f $@|wq" $(*B).in
|
||||
$(VIMPROG) -u dos.vim -U NONE --noplugin "+set ff=dos|f $@|wq" $(*B).in
|
||||
|
||||
# For each input file dostmp/test99.in run the tests.
|
||||
# This moves test99.in to test99.in.bak temporarily.
|
||||
@@ -56,7 +55,7 @@ $(TEST_OUTFILES): $(DOSTMP)\$(*B).in
|
||||
-@if exist Xfind rd /s /q Xfind
|
||||
-@del X*
|
||||
-@if exist viminfo del viminfo
|
||||
$(VIMPROG) -u dos.vim --noplugin "+set ff=unix|f test.out|wq" \
|
||||
$(VIMPROG) -u dos.vim -U NONE --noplugin "+set ff=unix|f test.out|wq" \
|
||||
$(DOSTMP)\$(*B).out
|
||||
@diff test.out $*.ok & if errorlevel 1 \
|
||||
( move /y test.out $*.failed \
|
||||
@@ -90,6 +89,7 @@ clean:
|
||||
-if exist Xdir1 rd /s /q Xdir1
|
||||
-if exist Xfind rd /s /q Xfind
|
||||
-del X*
|
||||
-for /d %i in (X*) do @rmdir /s/q %i
|
||||
-if exist viminfo del viminfo
|
||||
-if exist test.log del test.log
|
||||
-if exist messages del messages
|
||||
@@ -114,4 +114,4 @@ bench_re_freeze.out: bench_re_freeze.vim
|
||||
newtests: $(NEW_TESTS)
|
||||
|
||||
.vim.res:
|
||||
$(VIMPROG) -u NONE -S runtest.vim $*.vim
|
||||
$(VIMPROG) -u NONE -U NONE -S runtest.vim $*.vim
|
||||
|
||||
@@ -35,7 +35,6 @@ include Make_all.mak
|
||||
# test10 'errorformat' is different
|
||||
# test12 can't unlink a swap file
|
||||
# test25 uses symbolic link
|
||||
# test27 can't edit file with "*" in file name
|
||||
# test54 doesn't work yet
|
||||
# test97 \{ and \$ are not escaped characters
|
||||
|
||||
@@ -66,8 +65,8 @@ win32: fixff $(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_WIN32)
|
||||
echo ALL DONE
|
||||
|
||||
fixff:
|
||||
-$(VIMPROG) -u dos.vim --noplugin "+argdo set ff=dos|upd" +q *.in *.ok
|
||||
-$(VIMPROG) -u dos.vim --noplugin "+argdo set ff=unix|upd" +q \
|
||||
-$(VIMPROG) -u dos.vim -U NONE --noplugin "+argdo set ff=dos|upd" +q *.in *.ok
|
||||
-$(VIMPROG) -u dos.vim -U NONE --noplugin "+argdo set ff=unix|upd" +q \
|
||||
dotest.in test60.ok test71.ok test74.ok test_listchars.ok
|
||||
|
||||
clean:
|
||||
|
||||
@@ -163,7 +163,7 @@ SCRIPT_PYTHON = test86.out test87.out
|
||||
-@ write sys$output " "$*" "
|
||||
-@ write sys$output "-----------------------------------------------"
|
||||
-@ !run the test
|
||||
-@ create/term/wait/nodetach mcr $(VIMPROG) $(GUI_OPTION) -u vms.vim --noplugin -s dotest.in $*.in
|
||||
-@ create/term/wait/nodetach mcr $(VIMPROG) $(GUI_OPTION) -u vms.vim -U NONE --noplugin -s dotest.in $*.in
|
||||
-@ !analyse the result
|
||||
-@ directory /size/date test.out
|
||||
-@ if "''F$SEARCH("test.out.*")'" .NES. "" then rename/nolog test.out $*.out
|
||||
|
||||
@@ -127,4 +127,4 @@ newtestssilent: $(NEW_TESTS)
|
||||
|
||||
|
||||
.vim.res:
|
||||
$(RUN_VIMTEST) -u NONE -S runtest.vim $*.vim
|
||||
$(RUN_VIMTEST) -u NONE -U NONE -S runtest.vim $*.vim
|
||||
|
||||
@@ -43,6 +43,9 @@ set nomore
|
||||
" Output all messages in English.
|
||||
lang mess C
|
||||
|
||||
" Always use forward slashes.
|
||||
set shellslash
|
||||
|
||||
let s:srcdir = expand('%:p:h:h')
|
||||
|
||||
" Support function: get the alloc ID by name.
|
||||
@@ -81,6 +84,7 @@ else
|
||||
endif
|
||||
|
||||
" Locate Test_ functions and execute them.
|
||||
set nomore
|
||||
redir @q
|
||||
function /^Test_
|
||||
redir END
|
||||
|
||||
@@ -2,6 +2,7 @@ Tests for backtrace debug commands. vim: set ft=vim :
|
||||
|
||||
STARTTEST
|
||||
:so small.vim
|
||||
:lang mess C
|
||||
:function! Foo()
|
||||
: let var1 = 1
|
||||
: let var2 = Bar(var1) + 9
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
Test for expanding file names
|
||||
|
||||
STARTTEST
|
||||
:!mkdir Xdir1
|
||||
:!mkdir Xdir2
|
||||
:!mkdir Xdir3
|
||||
:cd Xdir3
|
||||
:!mkdir Xdir4
|
||||
:cd ..
|
||||
:w Xdir1/file
|
||||
:w Xdir3/Xdir4/file
|
||||
:n Xdir?/*/file
|
||||
Go%:.w! test.out
|
||||
:n! Xdir?/*/nofile
|
||||
Go%:.w >>test.out
|
||||
:e! xx
|
||||
:!rm -rf Xdir1 Xdir2 Xdir3
|
||||
:qa!
|
||||
ENDTEST
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
Xdir3/Xdir4/file
|
||||
Xdir?/*/nofile
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
source test_backspace_opt.vim
|
||||
source test_cursor_func.vim
|
||||
source test_delete.vim
|
||||
source test_expand.vim
|
||||
source test_lispwords.vim
|
||||
source test_menu.vim
|
||||
source test_searchpos.vim
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
" Test argument list commands
|
||||
|
||||
func Test_argidx()
|
||||
args a b c
|
||||
last
|
||||
call assert_equal(2, argidx())
|
||||
%argdelete
|
||||
call assert_equal(0, argidx())
|
||||
|
||||
args a b c
|
||||
call assert_equal(0, argidx())
|
||||
next
|
||||
call assert_equal(1, argidx())
|
||||
next
|
||||
call assert_equal(2, argidx())
|
||||
1argdelete
|
||||
call assert_equal(1, argidx())
|
||||
1argdelete
|
||||
call assert_equal(0, argidx())
|
||||
1argdelete
|
||||
call assert_equal(0, argidx())
|
||||
endfunc
|
||||
@@ -0,0 +1,99 @@
|
||||
" Test for delete().
|
||||
|
||||
func Test_file_delete()
|
||||
split Xfile
|
||||
call setline(1, ['a', 'b'])
|
||||
wq
|
||||
call assert_equal(['a', 'b'], readfile('Xfile'))
|
||||
call assert_equal(0, delete('Xfile'))
|
||||
call assert_fails('call readfile("Xfile")', 'E484:')
|
||||
call assert_equal(-1, delete('Xfile'))
|
||||
endfunc
|
||||
|
||||
func Test_dir_delete()
|
||||
call mkdir('Xdir1')
|
||||
call assert_true(isdirectory('Xdir1'))
|
||||
call assert_equal(0, delete('Xdir1', 'd'))
|
||||
call assert_false(isdirectory('Xdir1'))
|
||||
call assert_equal(-1, delete('Xdir1', 'd'))
|
||||
endfunc
|
||||
|
||||
func Test_recursive_delete()
|
||||
call mkdir('Xdir1')
|
||||
call mkdir('Xdir1/subdir')
|
||||
call mkdir('Xdir1/empty')
|
||||
split Xdir1/Xfile
|
||||
call setline(1, ['a', 'b'])
|
||||
w
|
||||
w Xdir1/subdir/Xfile
|
||||
close
|
||||
call assert_true(isdirectory('Xdir1'))
|
||||
call assert_equal(['a', 'b'], readfile('Xdir1/Xfile'))
|
||||
call assert_true(isdirectory('Xdir1/subdir'))
|
||||
call assert_equal(['a', 'b'], readfile('Xdir1/subdir/Xfile'))
|
||||
call assert_true(isdirectory('Xdir1/empty'))
|
||||
call assert_equal(0, delete('Xdir1', 'rf'))
|
||||
call assert_false(isdirectory('Xdir1'))
|
||||
call assert_equal(-1, delete('Xdir1', 'd'))
|
||||
endfunc
|
||||
|
||||
func Test_symlink_delete()
|
||||
if !has('unix')
|
||||
return
|
||||
endif
|
||||
split Xfile
|
||||
call setline(1, ['a', 'b'])
|
||||
wq
|
||||
silent !ln -s Xfile Xlink
|
||||
" Delete the link, not the file
|
||||
call assert_equal(0, delete('Xlink'))
|
||||
call assert_equal(-1, delete('Xlink'))
|
||||
call assert_equal(0, delete('Xfile'))
|
||||
endfunc
|
||||
|
||||
func Test_symlink_dir_delete()
|
||||
if !has('unix')
|
||||
return
|
||||
endif
|
||||
call mkdir('Xdir1')
|
||||
silent !ln -s Xdir1 Xlink
|
||||
call assert_true(isdirectory('Xdir1'))
|
||||
call assert_true(isdirectory('Xlink'))
|
||||
" Delete the link, not the directory
|
||||
call assert_equal(0, delete('Xlink'))
|
||||
call assert_equal(-1, delete('Xlink'))
|
||||
call assert_equal(0, delete('Xdir1', 'd'))
|
||||
endfunc
|
||||
|
||||
func Test_symlink_recursive_delete()
|
||||
if !has('unix')
|
||||
return
|
||||
endif
|
||||
call mkdir('Xdir3')
|
||||
call mkdir('Xdir3/subdir')
|
||||
call mkdir('Xdir4')
|
||||
split Xdir3/Xfile
|
||||
call setline(1, ['a', 'b'])
|
||||
w
|
||||
w Xdir3/subdir/Xfile
|
||||
w Xdir4/Xfile
|
||||
close
|
||||
silent !ln -s ../Xdir4 Xdir3/Xlink
|
||||
|
||||
call assert_true(isdirectory('Xdir3'))
|
||||
call assert_equal(['a', 'b'], readfile('Xdir3/Xfile'))
|
||||
call assert_true(isdirectory('Xdir3/subdir'))
|
||||
call assert_equal(['a', 'b'], readfile('Xdir3/subdir/Xfile'))
|
||||
call assert_true(isdirectory('Xdir4'))
|
||||
call assert_true(isdirectory('Xdir3/Xlink'))
|
||||
call assert_equal(['a', 'b'], readfile('Xdir4/Xfile'))
|
||||
|
||||
call assert_equal(0, delete('Xdir3', 'rf'))
|
||||
call assert_false(isdirectory('Xdir3'))
|
||||
call assert_equal(-1, delete('Xdir3', 'd'))
|
||||
" symlink is deleted, not the directory it points to
|
||||
call assert_true(isdirectory('Xdir4'))
|
||||
call assert_equal(['a', 'b'], readfile('Xdir4/Xfile'))
|
||||
call assert_equal(0, delete('Xdir4/Xfile'))
|
||||
call assert_equal(0, delete('Xdir4', 'd'))
|
||||
endfunc
|
||||
@@ -0,0 +1,41 @@
|
||||
" Test for expanding file names
|
||||
|
||||
func Test_with_directories()
|
||||
call mkdir('Xdir1')
|
||||
call mkdir('Xdir2')
|
||||
call mkdir('Xdir3')
|
||||
cd Xdir3
|
||||
call mkdir('Xdir4')
|
||||
cd ..
|
||||
|
||||
split Xdir1/file
|
||||
call setline(1, ['a', 'b'])
|
||||
w
|
||||
w Xdir3/Xdir4/file
|
||||
close
|
||||
|
||||
next Xdir?/*/file
|
||||
call assert_equal('Xdir3/Xdir4/file', expand('%'))
|
||||
if has('unix')
|
||||
next! Xdir?/*/nofile
|
||||
call assert_equal('Xdir?/*/nofile', expand('%'))
|
||||
endif
|
||||
" Edit another file, on MS-Windows the swap file would be in use and can't
|
||||
" be deleted.
|
||||
edit foo
|
||||
|
||||
call assert_equal(0, delete('Xdir1', 'rf'))
|
||||
call assert_equal(0, delete('Xdir2', 'rf'))
|
||||
call assert_equal(0, delete('Xdir3', 'rf'))
|
||||
endfunc
|
||||
|
||||
func Test_with_tilde()
|
||||
let dir = getcwd()
|
||||
call mkdir('Xdir ~ dir')
|
||||
call assert_true(isdirectory('Xdir ~ dir'))
|
||||
cd Xdir\ ~\ dir
|
||||
call assert_true(getcwd() =~ 'Xdir \~ dir')
|
||||
exe 'cd ' . fnameescape(dir)
|
||||
call delete('Xdir ~ dir', 'd')
|
||||
call assert_false(isdirectory('Xdir ~ dir'))
|
||||
endfunc
|
||||
@@ -1,5 +1,5 @@
|
||||
" Test various aspects of the Vim language.
|
||||
" This was formerly in test49.
|
||||
" Most of this was formerly in test49.
|
||||
|
||||
"-------------------------------------------------------------------------------
|
||||
" Test environment {{{1
|
||||
@@ -906,6 +906,20 @@ func Test_if_bar_fail()
|
||||
call assert_equal('acdfh-acfh', g:test15_result)
|
||||
endfunc
|
||||
|
||||
"-------------------------------------------------------------------------------
|
||||
" Test 90: Recognizing {} in variable name. {{{1
|
||||
"-------------------------------------------------------------------------------
|
||||
|
||||
func Test_curlies()
|
||||
let s:var = 66
|
||||
let ns = 's'
|
||||
call assert_equal(66, {ns}:var)
|
||||
|
||||
let g:a = {}
|
||||
let g:b = 't'
|
||||
let g:a[g:b] = 77
|
||||
call assert_equal(77, g:a['t'])
|
||||
endfunc
|
||||
|
||||
"-------------------------------------------------------------------------------
|
||||
" Modelines {{{1
|
||||
|
||||
@@ -756,6 +756,38 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1122,
|
||||
/**/
|
||||
1121,
|
||||
/**/
|
||||
1120,
|
||||
/**/
|
||||
1119,
|
||||
/**/
|
||||
1118,
|
||||
/**/
|
||||
1117,
|
||||
/**/
|
||||
1116,
|
||||
/**/
|
||||
1115,
|
||||
/**/
|
||||
1114,
|
||||
/**/
|
||||
1113,
|
||||
/**/
|
||||
1112,
|
||||
/**/
|
||||
1111,
|
||||
/**/
|
||||
1110,
|
||||
/**/
|
||||
1109,
|
||||
/**/
|
||||
1108,
|
||||
/**/
|
||||
1107,
|
||||
/**/
|
||||
1106,
|
||||
/**/
|
||||
|
||||
@@ -838,6 +838,8 @@ extern char *(*dyn_libintl_textdomain)(const char *domainname);
|
||||
#define EW_ALLLINKS 0x1000 /* also links not pointing to existing file */
|
||||
#define EW_SHELLCMD 0x2000 /* called from expand_shellcmd(), don't check
|
||||
* if executable is in $PATH */
|
||||
#define EW_DODOT 0x4000 /* also files starting with a dot */
|
||||
#define EW_EMPTYOK 0x8000 /* no matches is not an error */
|
||||
|
||||
/* Flags for find_file_*() functions. */
|
||||
#define FINDFILE_FILE 0 /* only files */
|
||||
|
||||
Reference in New Issue
Block a user