Merge remote-tracking branch 'vim/master'

This commit is contained in:
Kazuki Sakamoto
2015-12-28 14:13:11 -08:00
19 changed files with 658 additions and 704 deletions
+14 -7
View File
@@ -1,4 +1,4 @@
*eval.txt* For Vim version 7.4. Last change: 2015 Dec 03
*eval.txt* For Vim version 7.4. Last change: 2015 Dec 28
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -5228,14 +5228,15 @@ search({pattern} [, {flags} [, {stopline} [, {timeout}]]]) *search()*
move. No error message is given.
{flags} is a String, which can contain these character flags:
'b' search backward instead of forward
'c' accept a match at the cursor position
'b' search Backward instead of forward
'c' accept a match at the Cursor position
'e' move to the End of the match
'n' do Not move the cursor
'p' return number of matching sub-pattern (see below)
's' set the ' mark at the previous location of the cursor
'w' wrap around the end of the file
'W' don't wrap around the end of the file
'p' return number of matching sub-Pattern (see below)
's' Set the ' mark at the previous location of the cursor
'w' Wrap around the end of the file
'W' don't Wrap around the end of the file
'z' start searching at the cursor column instead of zero
If neither 'w' or 'W' is given, the 'wrapscan' option applies.
If the 's' flag is supplied, the ' mark is set, only if the
@@ -5243,6 +5244,12 @@ search({pattern} [, {flags} [, {stopline} [, {timeout}]]]) *search()*
flag.
'ignorecase', 'smartcase' and 'magic' are used.
When the 'z' flag is not given seaching always starts in
column zero and then matches before the cursor are skipped.
When the 'c' flag is present in 'cpo' the next search starts
after the match. Without the 'c' flag the next search starts
one column further.
When the {stopline} argument is given then the search stops
after searching this line. This is useful to restrict the
+10 -2
View File
@@ -16499,6 +16499,7 @@ f_reverse(argvars, rettv)
#define SP_START 0x10 /* accept match at start position */
#define SP_SUBPAT 0x20 /* return nr of matching sub-pattern */
#define SP_END 0x40 /* leave cursor at end of match */
#define SP_COLUMN 0x80 /* start at cursor column */
static int get_search_arg __ARGS((typval_T *varp, int *flagsp));
@@ -16540,6 +16541,7 @@ get_search_arg(varp, flagsp)
case 'p': mask = SP_SUBPAT; break;
case 'r': mask = SP_REPEAT; break;
case 's': mask = SP_SETPCMARK; break;
case 'z': mask = SP_COLUMN; break;
}
if (mask == 0)
{
@@ -16558,7 +16560,7 @@ get_search_arg(varp, flagsp)
}
/*
* Shared by search() and searchpos() functions
* Shared by search() and searchpos() functions.
*/
static int
search_cmn(argvars, match_pos, flagsp)
@@ -16590,6 +16592,8 @@ search_cmn(argvars, match_pos, flagsp)
options |= SEARCH_START;
if (flags & SP_END)
options |= SEARCH_END;
if (flags & SP_COLUMN)
options |= SEARCH_COL;
/* Optional arguments: line number to stop searching and timeout. */
if (argvars[1].v_type != VAR_UNKNOWN && argvars[2].v_type != VAR_UNKNOWN)
@@ -23119,7 +23123,11 @@ ex_function(eap)
/* insert the new function in the function list */
STRCPY(fp->uf_name, name);
hash_add(&func_hashtab, UF2HIKEY(fp));
if (hash_add(&func_hashtab, UF2HIKEY(fp)) == FAIL)
{
vim_free(fp);
goto erret;
}
}
fp->uf_args = newargs;
fp->uf_lines = newlines;
+101 -11
View File
@@ -81,6 +81,11 @@
# define RUBY19_OR_LATER 1
#endif
#if (defined(RUBY_VERSION) && RUBY_VERSION >= 20) \
|| (defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 20)
# define RUBY20_OR_LATER 1
#endif
#if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 19
/* Ruby 1.9 defines a number of static functions which use rb_num2long and
* rb_int2big */
@@ -103,7 +108,6 @@
#endif
#if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 22
# define rb_gc_writebarrier_unprotect rb_gc_writebarrier_unprotect_stub
# define rb_check_type rb_check_type_stub
#endif
#ifdef FEAT_GUI_MACVIM
@@ -130,6 +134,16 @@
# define __OPENTRANSPORTPROVIDERS__
#endif
/*
* The TypedData_XXX macro family can be used since Ruby 1.9.2 but
* rb_data_type_t changed in 1.9.3, therefore require at least 2.0.
* The old Data_XXX macro family was deprecated on Ruby 2.2.
* Use TypedData_XXX if available.
*/
#if defined(TypedData_Wrap_Struct) && defined(RUBY20_OR_LATER)
# define USE_TYPEDDATA 1
#endif
/*
* Backward compatibility for Ruby 1.8 and earlier.
* Ruby 1.9 does not provide STR2CSTR, instead StringValuePtr is provided.
@@ -192,11 +206,20 @@ static void ruby_vim_init(void);
*/
# define rb_assoc_new dll_rb_assoc_new
# define rb_cObject (*dll_rb_cObject)
# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER < 22
# define rb_check_type dll_rb_check_type
# define rb_check_type dll_rb_check_type
# ifdef USE_TYPEDDATA
# define rb_check_typeddata dll_rb_check_typeddata
# endif
# define rb_class_path dll_rb_class_path
# define rb_data_object_alloc dll_rb_data_object_alloc
# ifdef USE_TYPEDDATA
# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 23
# define rb_data_typed_object_wrap dll_rb_data_typed_object_wrap
# else
# define rb_data_typed_object_alloc dll_rb_data_typed_object_alloc
# endif
# else
# define rb_data_object_alloc dll_rb_data_object_alloc
# endif
# define rb_define_class_under dll_rb_define_class_under
# define rb_define_const dll_rb_define_const
# define rb_define_global_function dll_rb_define_global_function
@@ -305,8 +328,19 @@ static VALUE *dll_rb_cObject;
VALUE *dll_rb_cSymbol;
VALUE *dll_rb_cTrueClass;
static void (*dll_rb_check_type) (VALUE,int);
# ifdef USE_TYPEDDATA
static void *(*dll_rb_check_typeddata) (VALUE,const rb_data_type_t *);
# endif
static VALUE (*dll_rb_class_path) (VALUE);
# ifdef USE_TYPEDDATA
# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 23
static VALUE (*dll_rb_data_typed_object_wrap) (VALUE, void*, const rb_data_type_t *);
# else
static VALUE (*dll_rb_data_typed_object_alloc) (VALUE, void*, const rb_data_type_t *);
# endif
# else
static VALUE (*dll_rb_data_object_alloc) (VALUE, void*, RUBY_DATA_FUNC, RUBY_DATA_FUNC);
# endif
static VALUE (*dll_rb_define_class_under) (VALUE, const char*, VALUE);
static void (*dll_rb_define_const) (VALUE,const char*,VALUE);
static void (*dll_rb_define_global_function) (const char*,VALUE(*)(),int);
@@ -459,13 +493,6 @@ void rb_gc_writebarrier_unprotect_stub(VALUE obj)
# endif
# endif
# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 22
void rb_check_type_stub(VALUE v, int i)
{
dll_rb_check_type(v, i);
}
# endif
static HINSTANCE hinstRuby = NULL; /* Instance of ruby.dll */
/*
@@ -488,8 +515,19 @@ static struct
{"rb_cSymbol", (RUBY_PROC*)&dll_rb_cSymbol},
{"rb_cTrueClass", (RUBY_PROC*)&dll_rb_cTrueClass},
{"rb_check_type", (RUBY_PROC*)&dll_rb_check_type},
# ifdef USE_TYPEDDATA
{"rb_check_typeddata", (RUBY_PROC*)&dll_rb_check_typeddata},
# endif
{"rb_class_path", (RUBY_PROC*)&dll_rb_class_path},
# ifdef USE_TYPEDDATA
# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 23
{"rb_data_typed_object_wrap", (RUBY_PROC*)&dll_rb_data_typed_object_wrap},
# else
{"rb_data_typed_object_alloc", (RUBY_PROC*)&dll_rb_data_typed_object_alloc},
# endif
# else
{"rb_data_object_alloc", (RUBY_PROC*)&dll_rb_data_object_alloc},
# endif
{"rb_define_class_under", (RUBY_PROC*)&dll_rb_define_class_under},
{"rb_define_const", (RUBY_PROC*)&dll_rb_define_const},
{"rb_define_global_function", (RUBY_PROC*)&dll_rb_define_global_function},
@@ -1034,6 +1072,24 @@ static VALUE vim_evaluate(VALUE self UNUSED, VALUE str)
#endif
}
#ifdef USE_TYPEDDATA
static size_t buffer_dsize(const void *buf);
static const rb_data_type_t buffer_type = {
"vim_buffer",
{0, 0, buffer_dsize, {0, 0}},
0, 0,
# ifdef RUBY_TYPED_FREE_IMMEDIATELY
0,
# endif
};
static size_t buffer_dsize(const void *buf UNUSED)
{
return sizeof(buf_T);
}
#endif
static VALUE buffer_new(buf_T *buf)
{
if (buf->b_ruby_ref)
@@ -1042,7 +1098,11 @@ static VALUE buffer_new(buf_T *buf)
}
else
{
#ifdef USE_TYPEDDATA
VALUE obj = TypedData_Wrap_Struct(cBuffer, &buffer_type, buf);
#else
VALUE obj = Data_Wrap_Struct(cBuffer, 0, 0, buf);
#endif
buf->b_ruby_ref = (void *) obj;
rb_hash_aset(objtbl, rb_obj_id(obj), obj);
return obj;
@@ -1053,7 +1113,11 @@ static buf_T *get_buf(VALUE obj)
{
buf_T *buf;
#ifdef USE_TYPEDDATA
TypedData_Get_Struct(obj, buf_T, &buffer_type, buf);
#else
Data_Get_Struct(obj, buf_T, buf);
#endif
if (buf == NULL)
rb_raise(eDeletedBufferError, "attempt to refer to deleted buffer");
return buf;
@@ -1250,6 +1314,24 @@ static VALUE buffer_append(VALUE self, VALUE num, VALUE str)
return str;
}
#ifdef USE_TYPEDDATA
static size_t window_dsize(const void *buf);
static const rb_data_type_t window_type = {
"vim_window",
{0, 0, window_dsize, {0, 0}},
0, 0,
# ifdef RUBY_TYPED_FREE_IMMEDIATELY
0,
# endif
};
static size_t window_dsize(const void *win UNUSED)
{
return sizeof(win_T);
}
#endif
static VALUE window_new(win_T *win)
{
if (win->w_ruby_ref)
@@ -1258,7 +1340,11 @@ static VALUE window_new(win_T *win)
}
else
{
#ifdef USE_TYPEDDATA
VALUE obj = TypedData_Wrap_Struct(cVimWindow, &window_type, win);
#else
VALUE obj = Data_Wrap_Struct(cVimWindow, 0, 0, win);
#endif
win->w_ruby_ref = (void *) obj;
rb_hash_aset(objtbl, rb_obj_id(obj), obj);
return obj;
@@ -1269,7 +1355,11 @@ static win_T *get_win(VALUE obj)
{
win_T *win;
#ifdef USE_TYPEDDATA
TypedData_Get_Struct(obj, win_T, &window_type, win);
#else
Data_Get_Struct(obj, win_T, win);
#endif
if (win == NULL)
rb_raise(eDeletedWindowError, "attempt to refer to deleted window");
return win;
+8 -3
View File
@@ -587,6 +587,7 @@ last_pat_prog(regmatch)
* if (options & SEARCH_KEEP) keep previous search pattern
* if (options & SEARCH_FOLD) match only once in a closed fold
* if (options & SEARCH_PEEK) check for typed char, cancel search
* if (options & SEARCH_COL) start at pos->col instead of zero
*
* Return FAIL (zero) for failure, non-zero for success.
* When FEAT_EVAL is defined, returns the index of the first matching
@@ -608,6 +609,7 @@ searchit(win, buf, pos, dir, pat, count, options, pat_use, stop_lnum, tm)
{
int found;
linenr_T lnum; /* no init to shut up Apollo cc */
colnr_T col;
regmmatch_T regmatch;
char_u *ptr;
colnr_T matchcol;
@@ -720,12 +722,14 @@ searchit(win, buf, pos, dir, pat, count, options, pat_use, stop_lnum, tm)
/*
* Look for a match somewhere in line "lnum".
*/
col = at_first_line && (options & SEARCH_COL) ? pos->col
: (colnr_T)0;
nmatched = vim_regexec_multi(&regmatch, win, buf,
lnum, (colnr_T)0,
lnum, col,
#ifdef FEAT_RELTIME
tm
tm
#else
NULL
NULL
#endif
);
/* Abort searching on an error (e.g., out of stack). */
@@ -1107,6 +1111,7 @@ set_vv_searchforward()
/*
* Return the number of the first subpat that matched.
* Return zero if none of them matched.
*/
static int
first_submatch(rp)
+184
View File
@@ -0,0 +1,184 @@
#
# Common Makefile, defines the list of tests to run.
#
# The first script creates small.vim.
SCRIPTS_FIRST = \
test1.out
# Tests that run on all systems.
SCRIPTS_ALL = \
test3.out \
test4.out \
test5.out \
test6.out \
test7.out \
test8.out \
test9.out \
test13.out \
test14.out \
test15.out \
test18.out \
test19.out \
test20.out \
test21.out \
test22.out \
test23.out \
test24.out \
test26.out \
test28.out \
test29.out \
test31.out \
test33.out \
test34.out \
test35.out \
test36.out \
test37.out \
test38.out \
test39.out \
test40.out \
test41.out \
test42.out \
test43.out \
test44.out \
test45.out \
test46.out \
test47.out \
test48.out \
test51.out \
test53.out \
test55.out \
test56.out \
test57.out \
test60.out \
test61.out \
test62.out \
test63.out \
test64.out \
test65.out \
test66.out \
test67.out \
test68.out \
test69.out \
test70.out \
test71.out \
test73.out \
test74.out \
test75.out \
test76.out \
test77.out \
test79.out \
test80.out \
test81.out \
test82.out \
test84.out \
test88.out \
test90.out \
test91.out \
test92.out \
test93.out \
test94.out \
test95.out \
test96.out \
test98.out \
test99.out \
test101.out \
test102.out \
test103.out \
test104.out \
test105.out \
test106.out \
test107.out \
test_argument_0count.out \
test_argument_count.out \
test_autocmd_option.out \
test_autoformat_join.out \
test_breakindent.out \
test_changelist.out \
test_charsearch.out \
test_close_count.out \
test_command_count.out \
test_comparators.out \
test_erasebackword.out \
test_eval.out \
test_fixeol.out \
test_increment.out \
test_insertcount.out \
test_listchars.out \
test_listlbr.out \
test_listlbr_utf8.out \
test_mapping.out \
test_marks.out \
test_match_conceal.out \
test_nested_function.out \
test_options.out \
test_perl.out \
test_qf_title.out \
test_ruby.out \
test_search_mbyte.out \
test_set.out \
test_signs.out \
test_tagcase.out \
test_textobjects.out \
test_utf8.out \
test_writefile.out
# Tests that run on most systems, but not on Amiga.
SCRIPTS_MORE1 = \
test11.out \
test52.out \
test85.out \
test86.out \
test87.out
# Tests that run on most systems, but not on Amiga and DOS/Windows.
SCRIPTS_MORE2 = \
test2.out \
test10.out \
test12.out \
test25.out \
test27.out \
test49.out \
test97.out
# Tests that run on most systems, but not MingW and Cygwin.
SCRIPTS_MORE3 = \
test54.out
# Tests that run on most systems, but not on VMS
SCRIPTS_MORE4 = \
test17.out \
test30.out \
test32.out \
test58.out \
test59.out \
test72.out \
test78.out \
test83.out \
test89.out
# Tests specifically for MS-Windows.
SCRIPTS_WIN32 = test50.out
# Tests for the GUI.
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 \
test_cdo.res \
test_alot.res
# Explicit dependencies.
test49.out: test49.vim
test60.out: test60.vim
+11 -190
View File
@@ -5,6 +5,10 @@
VIMPROG = /vim
default: nongui
include Make_all.mak
# These tests don't work (yet):
# test2 "\\tmp" doesn't work
# test10 'errorformat' is different
@@ -16,64 +20,14 @@ VIMPROG = /vim
# test85 no Lua interface
# test86, 87 no Python interface
SCRIPTS = test1.out test3.out test4.out test5.out test6.out \
test7.out test8.out test9.out \
test13.out test14.out test15.out test17.out \
test18.out test19.out test20.out test21.out test22.out \
test23.out test24.out test26.out \
test28.out test29.out test30.out test31.out test32.out \
test33.out test34.out test35.out test36.out test37.out \
test38.out test39.out test40.out test41.out test42.out \
test43.out test44.out test45.out test46.out test47.out \
test48.out test51.out test53.out test54.out test55.out \
test56.out test57.out test58.out test59.out test60.out \
test61.out test62.out test63.out test64.out test65.out \
test66.out test67.out test68.out test69.out test70.out \
test71.out test72.out test73.out test74.out test75.out \
test76.out test77.out test78.out test79.out test80.out \
test81.out test82.out test83.out test84.out test88.out \
test89.out test90.out test91.out test92.out test93.out \
test94.out test95.out test96.out test97.out test98.out \
test99.out test101.out test102.out test103.out \
test104.out test105.out test106.out test107.out \
test_argument_0count.out \
test_argument_count.out \
test_autocmd_option.out \
test_autoformat_join.out \
test_breakindent.out \
test_cdo.out \
test_changelist.out \
test_charsearch.out \
test_close_count.out \
test_command_count.out \
test_comparators.out \
test_erasebackword.out \
test_eval.out \
test_fixeol.out \
test_increment.out \
test_insertcount.out \
test_listchars.out \
test_listlbr.out \
test_listlbr_utf8.out \
test_mapping.out \
test_marks.out \
test_match_conceal.out \
test_nested_function.out \
test_options.out \
test_perl.out \
test_qf_title.out \
test_ruby.out \
test_search_mbyte.out \
test_set.out \
test_signs.out \
test_tagcase.out \
test_textobjects.out \
test_utf8.out \
test_writefile.out
SCRIPTS = $(SCRIPTS_ALL) $(SCRIPTS_MORE3) $(SCRIPTS_MORE4)
# Must run test1 first to create small.vim.
$(SCRIPTS) $(SCRIPTS_GUI) $(NEW_TESTS): $(SCRIPTS_FIRST)
.SUFFIXES: .in .out
nongui: /tmp $(SCRIPTS)
nongui: /tmp $(SCRIPTS_FIRST) $(SCRIPTS)
csh -c echo ALL DONE
clean:
@@ -91,138 +45,5 @@ clean:
/tmp:
makedir /tmp
# Manx requires all dependencies...
test1.out: test1.in
test2.out: test2.in
test3.out: test3.in
test4.out: test4.in
test5.out: test5.in
test6.out: test6.in
test7.out: test7.in
test8.out: test8.in
test9.out: test9.in
test10.out: test10.in
test11.out: test11.in
test12.out: test12.in
test13.out: test13.in
test14.out: test14.in
test15.out: test15.in
test16.out: test16.in
test17.out: test17.in
test18.out: test18.in
test19.out: test19.in
test20.out: test20.in
test21.out: test21.in
test22.out: test22.in
test23.out: test23.in
test24.out: test24.in
test25.out: test25.in
test26.out: test26.in
test27.out: test27.in
test28.out: test28.in
test29.out: test29.in
test30.out: test30.in
test31.out: test31.in
test32.out: test32.in
test33.out: test33.in
test34.out: test34.in
test35.out: test35.in
test36.out: test36.in
test37.out: test37.in
test38.out: test38.in
test39.out: test39.in
test40.out: test40.in
test41.out: test41.in
test42.out: test42.in
test43.out: test43.in
test44.out: test44.in
test45.out: test45.in
test46.out: test46.in
test47.out: test47.in
test48.out: test48.in
test51.out: test51.in
test53.out: test53.in
test54.out: test54.in
test55.out: test55.in
test56.out: test56.in
test57.out: test57.in
test58.out: test58.in
test59.out: test59.in
test60.out: test60.in
test61.out: test61.in
test62.out: test62.in
test63.out: test63.in
test64.out: test64.in
test65.out: test65.in
test66.out: test66.in
test67.out: test67.in
test68.out: test68.in
test69.out: test69.in
test70.out: test70.in
test71.out: test71.in
test72.out: test72.in
test73.out: test73.in
test74.out: test74.in
test75.out: test75.in
test76.out: test76.in
test77.out: test77.in
test78.out: test78.in
test79.out: test79.in
test80.out: test80.in
test81.out: test81.in
test82.out: test82.in
test83.out: test83.in
test84.out: test84.in
test88.out: test88.in
test89.out: test89.in
test90.out: test90.in
test91.out: test91.in
test92.out: test92.in
test93.out: test93.in
test94.out: test94.in
test95.out: test95.in
test96.out: test96.in
test97.out: test97.in
test98.out: test98.in
test99.out: test99.in
test101.out: test101.in
test102.out: test102.in
test103.out: test103.in
test104.out: test104.in
test105.out: test105.in
test106.out: test106.in
test107.out: test107.in
test_argument_0count.out: test_argument_0count.in
test_argument_count.out: test_argument_count.in
test_autocmd_option.out: test_autocmd_option.in
test_autoformat_join.out: test_autoformat_join.in
test_breakindent.out: test_breakindent.in
test_cdo.out: test_cdo.in
test_changelist.out: test_changelist.in
test_charsearch.out: test_charsearch.in
test_close_count.out: test_close_count.in
test_command_count.out: test_command_count.in
test_comparators.out: test_comparators.in
test_erasebackword.out: test_erasebackword.in
test_eval.out: test_eval.in
test_increment.out: test_increment.in
test_fixeol.out: test_fixeol.in
test_insertcount.out: test_insertcount.in
test_listchars.out: test_listchars.in
test_listlbr.out: test_listlbr.in
test_listlbr_utf8.out: test_listlbr_utf8.in
test_mapping.out: test_mapping.in
test_marks.out: test_marks.in
test_match_conceal.out: test_match_conceal.in
test_nested_function.out: test_nested_function.in
test_options.out: test_options.in
test_perl.out: test_perl.in
test_qf_title.out: test_qf_title.in
test_ruby.out: test_ruby.in
test_search_mbyte.out: test_search_mbyte.in
test_set.out: test_set.in
test_signs.out: test_signs.in
test_tagcase.out: test_tagcase.in
test_textobjects.out: test_textobjects.in
test_utf8.out: test_utf8.in
test_writefile.out: test_writefile.in
# Manx requires all dependencies, but we stopped updating them.
# Delete the .out file(s) to run test(s).
+13 -64
View File
@@ -5,89 +5,38 @@
VIMPROG = ..\\vim
default: nongui
!include Make_all.mak
# Omitted:
# test2 "\\tmp" doesn't work.
# 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.
SCRIPTS16 = test1.out test19.out test20.out test22.out \
test23.out test24.out test28.out test29.out \
test35.out test36.out test43.out \
test44.out test45.out test46.out test47.out \
test48.out test51.out test53.out test54.out \
test55.out test56.out test57.out test58.out test59.out \
test60.out test61.out test62.out test63.out test64.out
SCRIPTS = $(SCRIPTS_ALL) $(SCRIPTS_MORE1) $(SCRIPTS_MORE3) $(SCRIPTS_MORE4)
SCRIPTS = test3.out test4.out test5.out test6.out test7.out \
test8.out test9.out test11.out test13.out test14.out \
test15.out test17.out test18.out test21.out test26.out \
test30.out test31.out test32.out test33.out test34.out \
test37.out test38.out test39.out test40.out test41.out \
test42.out test52.out test65.out test66.out test67.out \
test68.out test69.out test71.out test72.out test73.out \
test74.out test75.out test76.out test77.out test78.out \
test79.out test80.out test81.out test82.out test83.out \
test84.out test85.out test86.out test87.out test88.out \
test89.out test90.out test91.out test92.out test93.out \
test94.out test95.out test96.out test98.out test99.out \
test101.out test102.out test103.out test104.out \
test105.out test106.out test107.out\
test_argument_0count.out \
test_argument_count.out \
test_autocmd_option.out \
test_autoformat_join.out \
test_breakindent.out \
test_cdo.out \
test_changelist.out \
test_charsearch.out \
test_close_count.out \
test_command_count.out \
test_comparators.out \
test_erasebackword.out \
test_eval.out \
test_fixeol.out \
test_increment.out \
test_insertcount.out \
test_listchars.out \
test_listlbr.out \
test_listlbr_utf8.out \
test_mapping.out \
test_marks.out \
test_match_conceal.out \
test_nested_function.out \
test_options.out \
test_perl.out \
test_qf_title.out \
test_ruby.out \
test_search_mbyte.out \
test_set.out \
test_signs.out \
test_tagcase.out \
test_textobjects.out \
test_utf8.out \
test_writefile.out
SCRIPTS32 = test50.out test70.out
SCRIPTS_GUI = test16.out
TEST_OUTFILES = $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS32) $(SCRIPTS_GUI)
TEST_OUTFILES = $(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_WIN32) $(SCRIPTS_GUI)
DOSTMP = dostmp
DOSTMP_OUTFILES = $(TEST_OUTFILES:test=dostmp\test)
DOSTMP_INFILES = $(DOSTMP_OUTFILES:.out=.in)
.SUFFIXES: .in .out
nongui: nolog $(SCRIPTS16) $(SCRIPTS) report
# Must run test1 first to create small.vim.
$(SCRIPTS) $(SCRIPTS_GUI) $(SCRIPTS_WIN32) $(NEW_TESTS): $(SCRIPTS_FIRST)
nongui: nolog $(SCRIPTS_FIRST) $(SCRIPTS) report
small: nolog report
gui: nolog $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS_GUI) report
gui: nolog $(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_GUI) report
win32: nolog $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS32) report
win32: nolog $(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_WIN32) report
# Copy the input files to dostmp, changing the fileformat to dos.
$(DOSTMP_INFILES): $(*B).in
+14 -68
View File
@@ -24,86 +24,32 @@ endif
VIMPROG = ..$(DIRSLASH)vim
default: vimall
include Make_all.mak
# Omitted:
# test2 "\\tmp" doesn't work.
# test10 'errorformat' is different
# test12 can't unlink a swap file
# test25 uses symbolic link
# test27 can't edit file with "*" in file name
# test97 \{ and \$ are not escaped characters.
# test54 doesn't work yet
# test97 \{ and \$ are not escaped characters
SCRIPTS16 = test1.out test19.out test20.out test22.out \
test23.out test24.out test28.out test29.out \
test35.out test36.out test43.out \
test44.out test45.out test46.out test47.out \
test48.out test51.out test53.out \
test55.out test56.out test57.out test58.out test59.out \
test60.out test61.out test62.out test63.out test64.out
# Had to remove test54 which doesn't work yet.
# test54.out
SCRIPTS = test3.out test4.out test5.out test6.out test7.out \
test8.out test9.out test11.out test13.out test14.out \
test15.out test17.out test18.out test21.out test26.out \
test30.out test31.out test32.out test33.out test34.out \
test37.out test38.out test39.out test40.out test41.out \
test42.out test52.out test65.out test66.out test67.out \
test68.out test69.out test71.out test72.out test73.out \
test74.out test75.out test76.out test77.out test78.out \
test79.out test80.out test81.out test82.out test83.out \
test84.out test85.out test86.out test87.out test88.out \
test89.out test90.out test91.out test92.out test93.out \
test94.out test95.out test96.out test98.out test99.out \
test101.out test102.out test103.out test104.out \
test105.out test106.out test107.out \
test_argument_0count.out \
test_argument_count.out \
test_autocmd_option.out \
test_autoformat_join.out \
test_breakindent.out \
test_cdo.out \
test_changelist.out \
test_charsearch.out \
test_close_count.out \
test_command_count.out \
test_comparators.out \
test_erasebackword.out \
test_eval.out \
test_fixeol.out \
test_increment.out \
test_insertcount.out \
test_listchars.out \
test_listlbr.out \
test_listlbr_utf8.out \
test_mapping.out \
test_marks.out \
test_match_conceal.out \
test_nested_function.out \
test_options.out \
test_perl.out \
test_qf_title.out \
test_ruby.out \
test_search_mbyte.out \
test_set.out \
test_signs.out \
test_tagcase.out \
test_textobjects.out \
test_utf8.out \
test_writefile.out
SCRIPTS32 = test50.out test70.out
SCRIPTS_GUI = test16.out
SCRIPTS = $(SCRIPTS_ALL) $(SCRIPTS_MORE1) $(SCRIPTS_MORE4) $(SCRIPTS_WIN32)
SCRIPTS_BENCH = bench_re_freeze.out
# Must run test1 first to create small.vim.
$(SCRIPTS) $(SCRIPTS_GUI) $(SCRIPTS_WIN32) $(NEW_TESTS): $(SCRIPTS_FIRST)
.SUFFIXES: .in .out
vimall: fixff $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS_GUI) $(SCRIPTS32)
vimall: fixff $(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_GUI) $(SCRIPTS_WIN32)
echo ALL DONE
nongui: fixff $(SCRIPTS16) $(SCRIPTS)
nongui: fixff $(SCRIPTS_FIRST) $(SCRIPTS)
echo ALL DONE
benchmark: $(SCRIPTS_BENCH)
@@ -111,10 +57,10 @@ benchmark: $(SCRIPTS_BENCH)
small:
echo ALL DONE
gui: fixff $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS_GUI)
gui: fixff $(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_GUI)
echo ALL DONE
win32: fixff $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS32)
win32: fixff $(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_WIN32)
echo ALL DONE
fixff:
+13 -56
View File
@@ -1,10 +1,17 @@
#
# Makefile to run all tests for Vim, on OS/2
#
# OUTDATED, probably doesn't work.
#
# Requires a set of Unix tools: echo, diff, etc.
#
VIMPROG = ../vim.exe
default: all
include Make_all.mak
# Omitted:
# test2 "\\tmp" doesn't work.
# test10 'errorformat' is different
@@ -17,69 +24,19 @@ VIMPROG = ../vim.exe
# test86, 87 no Python interface
# test97 \{ and \$ are not escaped characters.
SCRIPTS = test1.out test3.out test4.out test5.out test6.out \
test7.out test8.out test9.out \
test13.out test14.out test15.out test17.out \
test18.out test19.out test20.out test21.out test22.out \
test23.out test24.out test26.out \
test28.out test29.out test30.out test31.out test32.out \
test33.out test34.out test35.out test36.out test37.out \
test38.out test39.out test40.out test41.out test42.out \
test43.out test44.out test45.out test46.out test47.out \
test48.out test51.out test53.out test54.out test55.out \
test56.out test57.out test58.out test59.out test60.out \
test61.out test62.out test63.out test64.out test65.out \
test66.out test67.out test68.out test69.out test70.out \
test71.out test72.out test73.out test74.out test75.out \
test76.out test77.out test78.out test79.out test80.out \
test81.out test82.out test83.out test84.out test88.out \
test89.out test90.out test91.out test92.out test93.out \
test94.out test95.out test96.out test98.out test99.out \
test101.out test102.out test103.out test104.out \
test105.out test106.out test107.out \
test_argument_0count.out \
test_argument_count.out \
test_autocmd_option.out \
test_autoformat_join.out \
test_breakindent.out \
test_cdo.out \
test_changelist.out \
test_charsearch.out \
test_close_count.out \
test_command_count.out \
test_comparators.out \
test_erasebackword.out \
test_eval.out \
test_fixeol.out \
test_increment.out \
test_insertcount.out \
test_listchars.out \
test_listlbr.out \
test_listlbr_utf8.out \
test_mapping.out \
test_marks.out \
test_match_conceal.out \
test_nested_function.out \
test_options.out \
test_perl.out \
test_qf_title.out \
test_ruby.out \
test_search_mbyte.out \
test_set.out \
test_signs.out \
test_tagcase.out \
test_textobjects.out \
test_utf8.out \
test_writefile.out
SCRIPTS = $(SCRIPTS_ALL) $(SCRIPTS_MORE3) $(SCRIPTS_MORE4)
SCRIPTS_BENCH = bench_re_freeze.out
.SUFFIXES: .in .out
all: /tmp $(SCRIPTS)
all: /tmp $(SCRIPTS_FIRST) $(SCRIPTS)
@echo ALL DONE
$(SCRIPTS): $(VIMPROG)
$(SCRIPTS_FIRST) $(SCRIPTS): $(VIMPROG)
# Must run test1 first to create small.vim.
$(SCRIPTS): $(SCRIPTS_FIRST)
benchmark: $(SCRIPTS_BENCH)
+8 -56
View File
@@ -4,7 +4,7 @@
# Authors: Zoltan Arpadffy, <arpadffy@polarhome.com>
# Sandor Kopanyi, <sandor.kopanyi@mailbox.hu>
#
# Last change: 2015 Dec 03
# Last change: 2015 Dec 28
#
# This has been tested on VMS 6.2 to 8.3 on DEC Alpha, VAX and IA64.
# Edit the lines in the Configuration section below to select.
@@ -74,62 +74,14 @@
VIMPROG = <->vim.exe
default : all
# This probably doesn't work, please fix.
.INCLUDE Make_all.mak
.SUFFIXES : .out .in
SCRIPT = test1.out test2.out test3.out test4.out test5.out \
test6.out test7.out test8.out test9.out test10a.out\
test13.out test14.out test15.out \
test18.out test19.out test20.out test21.out test22.out \
test23.out test24.out test26.out \
test28.out test29.out test30.out test31.out test32.out \
test33.out test34.out test35.out test36.out test37.out \
test38.out test39.out test40.out test41.out test42.out \
test43.out test44.out test45.out test46.out \
test48.out test49.out test51.out test53.out test54.out \
test55.out test56.out test57.out test60.out \
test61.out test62.out test63.out test64.out test65.out \
test66.out test67.out test68.out test69.out \
test71.out test72.out test74.out test75.out test76.out \
test77a.out test78.out test79.out test80.out test81.out \
test82.out test84.out test88.out test89.out \
test90.out test91.out test92.out test93.out test94.out \
test95.out test96.out test98.out test99.out \
test101.out test103.out test104.out \
test105.out test106.out test107.out \
test_argument_0count.out \
test_argument_count.out \
test_autocmd_option.out \
test_autoformat_join.out \
test_breakindent.out \
test_cdo.out \
test_changelist.out \
test_charsearch.out \
test_close_count.out \
test_command_count.out \
test_comparators.out \
test_erasebackword.out \
test_eval.out \
test_fixeol.out \
test_increment.out \
test_insertcount.out \
test_listchars.out \
test_listlbr.out \
test_listlbr_utf8.out \
test_mapping.out \
test_marks.out \
test_match_conceal.out \
test_nested_function.out \
test_options.out \
test_perl.out \
test_qf_title.out \
test_ruby.out \
test_search_mbyte.out \
test_set.out \
test_signs.out \
test_tagcase.out \
test_textobjects.out \
test_utf8.out \
test_writefile.out
SCRIPT = $(SCRIPTS_ALL) $(SCRIPTS_MORE3)
# Known problems:
# test17: ?
@@ -220,7 +172,7 @@ SCRIPT_PYTHON = test86.out test87.out
-@ if "''F$SEARCH("Xdotest.*")'" .NES. "" then delete/noconfirm/nolog Xdotest.*.*
-@ if "''F$SEARCH("Xtest.*")'" .NES. "" then delete/noconfirm/nolog Xtest.*.*
all : clean nolog $(START_WITH) $(SCRIPT) $(SCRIPT_GUI) $(SCRIPT_UNIX) $(SCRIPT_WIN) $(SCRIPT_SPELL) $(SCRIPT_ODS5) $(SCRIPT_GZIP) \
all : clean nolog $(SCRIPTS_FIRST) $(SCRIPT) $(SCRIPT_GUI) $(SCRIPT_UNIX) $(SCRIPT_WIN) $(SCRIPT_SPELL) $(SCRIPT_ODS5) $(SCRIPT_GZIP) \
$(SCRIPT_GDIFF) $(SCRIPT_MZSCH) $(SCRIPT_CKSUM) $(SCRIPT_ICONV) $(SCRIPT_LUA) $(SCRIPT_PYTHON) nolog
-@ write sys$output " "
-@ write sys$output "-----------------------------------------------"
+16 -66
View File
@@ -14,75 +14,26 @@ SCRIPTSOURCE = ../../runtime
# This will make testing about 10 times as slow.
# VALGRIND = valgrind --tool=memcheck --leak-check=yes --num-callers=15 --log-file=valgrind.$*
default: nongui
SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \
test7.out test8.out test9.out test10.out test11.out \
test12.out test13.out test14.out test15.out test17.out \
test18.out test19.out test20.out test21.out test22.out \
test23.out test24.out test25.out test26.out test27.out \
test28.out test29.out test30.out test31.out test32.out \
test33.out test34.out test35.out test36.out test37.out \
test38.out test39.out test40.out test41.out test42.out \
test43.out test44.out test45.out test46.out test47.out \
test48.out test49.out test51.out test52.out test53.out \
test54.out test55.out test56.out test57.out test58.out \
test59.out test60.out test61.out test62.out test63.out \
test64.out test65.out test66.out test67.out test68.out \
test69.out test70.out test71.out test72.out test73.out \
test74.out test75.out test76.out test77.out test78.out \
test79.out test80.out test81.out test82.out test83.out \
test84.out test85.out test86.out test87.out test88.out \
test89.out test90.out test91.out test92.out test93.out \
test94.out test95.out test96.out test97.out test98.out \
test99.out test101.out test102.out test103.out \
test104.out test105.out test106.out test107.out \
test_argument_0count.out \
test_argument_count.out \
test_autocmd_option.out \
test_autoformat_join.out \
test_breakindent.out \
test_cdo.out \
test_changelist.out \
test_charsearch.out \
test_close_count.out \
test_command_count.out \
test_comparators.out \
test_erasebackword.out \
test_eval.out \
test_fixeol.out \
test_increment.out \
test_insertcount.out \
test_listchars.out \
test_listlbr.out \
test_listlbr_utf8.out \
test_mapping.out \
test_marks.out \
test_match_conceal.out \
test_nested_function.out \
test_options.out \
test_perl.out \
test_qf_title.out \
test_ruby.out \
test_search_mbyte.out \
test_set.out \
test_signs.out \
test_tagcase.out \
test_textobjects.out \
test_utf8.out \
test_writefile.out
# The list of tests is common to all systems.
# This defines NEW_TESTS, SCRIPTS_ALL, SCRIPTS_MORE* and SCRIPTS_GUI.
include Make_all.mak
NEW_TESTS = test_assert.res \
test_alot.res
SCRIPTS_GUI = test16.out
SCRIPTS = $(SCRIPTS_ALL) \
$(SCRIPTS_MORE1) \
$(SCRIPTS_MORE2) \
$(SCRIPTS_MORE3) \
$(SCRIPTS_MORE4)
SCRIPTS_BENCH = bench_re_freeze.out
.SUFFIXES: .in .out .res .vim
nongui: nolog $(SCRIPTS) newtests report
nongui: nolog $(SCRIPTS_FIRST) $(SCRIPTS) newtests report
gui: nolog $(SCRIPTS) $(SCRIPTS_GUI) newtests report
gui: nolog $(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_GUI) newtests report
benchmark: $(SCRIPTS_BENCH)
@@ -94,7 +45,10 @@ report:
else echo ALL DONE; \
fi"
$(SCRIPTS) $(SCRIPTS_GUI) $(NEW_TESTS): $(VIMPROG)
$(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_GUI) $(NEW_TESTS): $(VIMPROG)
# Must run test1 first to create small.vim.
$(SCRIPTS) $(SCRIPTS_GUI) $(NEW_TESTS): $(SCRIPTS_FIRST)
RM_ON_RUN = test.out X* viminfo
RM_ON_START = tiny.vim small.vim mbyte.vim mzscheme.vim lua.vim test.ok benchmark.out
@@ -148,10 +102,6 @@ test1.out: test1.in
fi"
-rm -rf X* test.ok viminfo
test49.out: test49.vim
test60.out: test60.vim
bench_re_freeze.out: bench_re_freeze.vim
-rm -rf benchmark.out $(RM_ON_RUN)
# Sleep a moment to avoid that the xterm title is messed up.
@@ -173,4 +123,4 @@ RUN_VIMTEST = VIMRUNTIME=$(SCRIPTSOURCE); export VIMRUNTIME; $(VALGRIND) $(VIMPR
newtests: $(NEW_TESTS)
.vim.res:
$(RUN_VIMTEST) -u runtest.vim $*.vim
$(RUN_VIMTEST) -S runtest.vim $*.vim
+10 -7
View File
@@ -21,9 +21,7 @@
" It will be called after each Test_ function.
" Without the +eval feature we can't run these tests, bail out.
if 0
quit!
endif
so small.vim
" Check that the screen size is at least 24 x 80 characters.
if &lines < 24 || &columns < 80
@@ -38,7 +36,15 @@ endif
" Source the test script. First grab the file name, in case the script
" navigates away.
let testname = expand('%')
source %
let done = 0
let fail = 0
let errors = []
try
source %
catch
let fail += 1
call add(errors, 'Caught exception: ' . v:exception . ' @ ' . v:throwpoint)
endtry
" Locate Test_ functions and execute them.
redir @q
@@ -46,9 +52,6 @@ function /^Test_
redir END
let tests = split(substitute(@q, 'function \(\k*()\)', '\1', 'g'))
let done = 0
let fail = 0
let errors = []
for test in tests
if exists("*SetUp")
call SetUp()
+1
View File
@@ -2,5 +2,6 @@
" This makes testing go faster, since Vim doesn't need to restart.
source test_lispwords.vim
source test_searchpos.vim
source test_sort.vim
source test_undolevels.vim
-108
View File
@@ -1,108 +0,0 @@
Tests for the :cdo, :cfdo, :ldo and :lfdo commands
STARTTEST
:so small.vim
:lang mess C
:if !has('quickfix') | e! test.ok | wq! test.out | endif
:call writefile(["Line1", "Line2", "Line3"], 'Xtestfile1')
:call writefile(["Line1", "Line2", "Line3"], 'Xtestfile2')
:call writefile(["Line1", "Line2", "Line3"], 'Xtestfile3')
:function RunTests(cchar)
: let nl="\n"
: enew
: " Try with an empty list
: exe a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl"
: " Populate the list and then try
: exe a:cchar . "getexpr ['non-error 1', 'Xtestfile1:1:3:Line1', 'non-error 2', 'Xtestfile2:2:2:Line2', 'non-error 3', 'Xtestfile3:3:1:Line3']"
: exe a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl"
: " Run command only on selected error lines
: enew
: exe "2,3" . a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl"
: " Boundary condition tests
: enew
: exe "1,1" . a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl"
: enew
: exe "3" . a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl"
: " Range test commands
: enew
: exe "%" . a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl"
: enew
: exe "1,$" . a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl"
: enew
: exe a:cchar . 'prev'
: exe "." . a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl"
: " Invalid error lines test
: enew
: exe "27" . a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl"
: exe "4,5" . a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl"
: " Run commands from an unsaved buffer
: let v:errmsg=''
: enew
: setlocal modified
: exe "2,2" . a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl"
: if v:errmsg =~# 'No write since last change'
: let g:result .= 'Unsaved file change test passed' . nl
: else
: let g:result .= 'Unsaved file change test failed' . nl
: endif
: " If the executed command fails, then the operation should be aborted
: enew!
: let subst_count = 0
: exe a:cchar . "do s/Line/xLine/ | let subst_count += 1"
: if subst_count == 1 && getline('.') == 'xLine1'
: let g:result .= 'Abort command on error test passed' . nl
: else
: let g:result .= 'Abort command on error test failed' . nl
: endif
: exe "2,2" . a:cchar . "do! let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl"
: " List with no valid error entries
: edit! +2 Xtestfile1
: exe a:cchar . "getexpr ['non-error 1', 'non-error 2', 'non-error 3']"
: exe a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl"
: exe "2" . a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl"
: let v:errmsg=''
: exe "%" . a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl"
: exe "1,$" . a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl"
: exe "." . a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl"
: let g:result .= v:errmsg
: " List with only one valid entry
: exe a:cchar . "getexpr ['Xtestfile3:3:1:Line3']"
: exe a:cchar . "do let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl"
: " Tests for :cfdo and :lfdo commands
: exe a:cchar . "getexpr ['non-error 1', 'Xtestfile1:1:3:Line1', 'Xtestfile1:2:1:Line2', 'non-error 2', 'Xtestfile2:2:2:Line2', 'non-error 3', 'Xtestfile3:2:3:Line2', 'Xtestfile3:3:1:Line3']"
: exe a:cchar . "fdo let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl"
: exe "3" . a:cchar . "fdo let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl"
: exe "2,3" . a:cchar . "fdo let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl"
: exe "%" . a:cchar . "fdo let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl"
: exe "1,$" . a:cchar . "fdo let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl"
: exe a:cchar . 'pfile'
: exe "." . a:cchar . "fdo let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl"
: " List with only one valid entry
: exe a:cchar . "getexpr ['Xtestfile2:2:5:Line2']"
: exe a:cchar . "fdo let g:result .= expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' . nl"
:endfunction
:let result=''
:" Tests for the :cdo quickfix list command
:call RunTests('c')
:let result .= "\n"
:" Tests for the :ldo location list command
:call RunTests('l')
:edit! test.out
:0put =result
:wq!
ENDTEST
-66
View File
@@ -1,66 +0,0 @@
Xtestfile1 1L 3C
Xtestfile2 2L 2C
Xtestfile3 3L 1C
Xtestfile2 2L 2C
Xtestfile3 3L 1C
Xtestfile1 1L 3C
Xtestfile3 3L 1C
Xtestfile1 1L 3C
Xtestfile2 2L 2C
Xtestfile3 3L 1C
Xtestfile1 1L 3C
Xtestfile2 2L 2C
Xtestfile3 3L 1C
Xtestfile2 2L 2C
Unsaved file change test passed
Abort command on error test passed
Xtestfile2 2L 2C
Xtestfile3 3L 1C
Xtestfile1 1L 3C
Xtestfile2 2L 2C
Xtestfile3 2L 3C
Xtestfile3 2L 3C
Xtestfile2 2L 2C
Xtestfile3 2L 3C
Xtestfile1 1L 3C
Xtestfile2 2L 2C
Xtestfile3 2L 3C
Xtestfile1 1L 3C
Xtestfile2 2L 2C
Xtestfile3 2L 3C
Xtestfile2 2L 2C
Xtestfile2 2L 5C
Xtestfile1 1L 3C
Xtestfile2 2L 2C
Xtestfile3 3L 1C
Xtestfile2 2L 2C
Xtestfile3 3L 1C
Xtestfile1 1L 3C
Xtestfile3 3L 1C
Xtestfile1 1L 3C
Xtestfile2 2L 2C
Xtestfile3 3L 1C
Xtestfile1 1L 3C
Xtestfile2 2L 2C
Xtestfile3 3L 1C
Xtestfile2 2L 2C
Unsaved file change test passed
Abort command on error test passed
Xtestfile2 2L 2C
Xtestfile3 3L 1C
Xtestfile1 1L 3C
Xtestfile2 2L 2C
Xtestfile3 2L 3C
Xtestfile3 2L 3C
Xtestfile2 2L 2C
Xtestfile3 2L 3C
Xtestfile1 1L 3C
Xtestfile2 2L 2C
Xtestfile3 2L 3C
Xtestfile1 1L 3C
Xtestfile2 2L 2C
Xtestfile3 2L 3C
Xtestfile2 2L 2C
Xtestfile2 2L 5C
+206
View File
@@ -0,0 +1,206 @@
" Tests for the :cdo, :cfdo, :ldo and :lfdo commands
lang mess C
if !has('quickfix')
finish
endif
" Create the files used by the tests
function SetUp()
call writefile(["Line1", "Line2", "Line3"], 'Xtestfile1')
call writefile(["Line1", "Line2", "Line3"], 'Xtestfile2')
call writefile(["Line1", "Line2", "Line3"], 'Xtestfile3')
endfunction
" Remove the files used by the tests
function TearDown()
call delete('Xtestfile1')
call delete('Xtestfile2')
call delete('Xtestfile3')
endfunction
" Returns the current line in '<filename> <linenum>L <column>C' format
function GetRuler()
return expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C'
endfunction
" Tests for the :cdo and :ldo commands
function XdoTests(cchar)
enew
" Shortcuts for calling the cdo and ldo commands
let Xdo = a:cchar . 'do'
let Xgetexpr = a:cchar . 'getexpr'
let Xprev = a:cchar. 'prev'
let XdoCmd = Xdo . ' call add(l, GetRuler())'
" Try with an empty list
let l = []
exe XdoCmd
call assert_equal([], l)
" Populate the list and then try
exe Xgetexpr . " ['non-error 1', 'Xtestfile1:1:3:Line1', 'non-error 2', 'Xtestfile2:2:2:Line2', 'non-error 3', 'Xtestfile3:3:1:Line3']"
let l = []
exe XdoCmd
call assert_equal(['Xtestfile1 1L 3C', 'Xtestfile2 2L 2C', 'Xtestfile3 3L 1C'], l)
" Run command only on selected error lines
let l = []
enew
exe "2,3" . XdoCmd
call assert_equal(['Xtestfile2 2L 2C', 'Xtestfile3 3L 1C'], l)
" Boundary condition tests
let l = []
enew
exe "1,1" . XdoCmd
call assert_equal(['Xtestfile1 1L 3C'], l)
let l = []
enew
exe "3" . XdoCmd
call assert_equal(['Xtestfile3 3L 1C'], l)
" Range test commands
let l = []
enew
exe "%" . XdoCmd
call assert_equal(['Xtestfile1 1L 3C', 'Xtestfile2 2L 2C', 'Xtestfile3 3L 1C'], l)
let l = []
enew
exe "1,$" . XdoCmd
call assert_equal(['Xtestfile1 1L 3C', 'Xtestfile2 2L 2C', 'Xtestfile3 3L 1C'], l)
let l = []
enew
exe Xprev
exe "." . XdoCmd
call assert_equal(['Xtestfile2 2L 2C'], l)
let l = []
enew
exe "+" . XdoCmd
call assert_equal(['Xtestfile3 3L 1C'], l)
" Invalid error lines test
let l = []
enew
exe "silent! 27" . XdoCmd
exe "silent! 4,5" . XdoCmd
call assert_equal([], l)
" Run commands from an unsaved buffer
let v:errmsg=''
let l = []
enew
setlocal modified
exe "silent! 2,2" . XdoCmd
if v:errmsg !~# 'No write since last change'
call add(v:errors, 'Unsaved file change test failed')
endif
" If the executed command fails, then the operation should be aborted
enew!
let subst_count = 0
exe "silent!" . Xdo . " s/Line/xLine/ | let subst_count += 1"
if subst_count != 1 || getline('.') != 'xLine1'
call add(v:errors, 'Abort command on error test failed')
endif
let l = []
exe "2,2" . Xdo . "! call add(l, GetRuler())"
call assert_equal(['Xtestfile2 2L 2C'], l)
" List with no valid error entries
let l = []
edit! +2 Xtestfile1
exe Xgetexpr . " ['non-error 1', 'non-error 2', 'non-error 3']"
exe XdoCmd
call assert_equal([], l)
exe "silent! 2" . XdoCmd
call assert_equal([], l)
let v:errmsg=''
exe "%" . XdoCmd
exe "1,$" . XdoCmd
exe "." . XdoCmd
call assert_equal('', v:errmsg)
" List with only one valid entry
let l = []
exe Xgetexpr . " ['Xtestfile3:3:1:Line3']"
exe XdoCmd
call assert_equal(['Xtestfile3 3L 1C'], l)
endfunction
" Tests for the :cfdo and :lfdo commands
function XfdoTests(cchar)
enew
" Shortcuts for calling the cfdo and lfdo commands
let Xfdo = a:cchar . 'fdo'
let Xgetexpr = a:cchar . 'getexpr'
let XfdoCmd = Xfdo . ' call add(l, GetRuler())'
let Xpfile = a:cchar. 'pfile'
" Clear the quickfix/location list
exe Xgetexpr . " []"
" Try with an empty list
let l = []
exe XfdoCmd
call assert_equal([], l)
" Populate the list and then try
exe Xgetexpr . " ['non-error 1', 'Xtestfile1:1:3:Line1', 'Xtestfile1:2:1:Line2', 'non-error 2', 'Xtestfile2:2:2:Line2', 'non-error 3', 'Xtestfile3:2:3:Line2', 'Xtestfile3:3:1:Line3']"
let l = []
exe XfdoCmd
call assert_equal(['Xtestfile1 1L 3C', 'Xtestfile2 2L 2C', 'Xtestfile3 2L 3C'], l)
" Run command only on selected error lines
let l = []
exe "2,3" . XfdoCmd
call assert_equal(['Xtestfile2 2L 2C', 'Xtestfile3 2L 3C'], l)
" Boundary condition tests
let l = []
exe "3" . XfdoCmd
call assert_equal(['Xtestfile3 2L 3C'], l)
" Range test commands
let l = []
exe "%" . XfdoCmd
call assert_equal(['Xtestfile1 1L 3C', 'Xtestfile2 2L 2C', 'Xtestfile3 2L 3C'], l)
let l = []
exe "1,$" . XfdoCmd
call assert_equal(['Xtestfile1 1L 3C', 'Xtestfile2 2L 2C', 'Xtestfile3 2L 3C'], l)
let l = []
exe Xpfile
exe "." . XfdoCmd
call assert_equal(['Xtestfile2 2L 2C'], l)
" List with only one valid entry
let l = []
exe Xgetexpr . " ['Xtestfile2:2:5:Line2']"
exe XfdoCmd
call assert_equal(['Xtestfile2 2L 5C'], l)
endfunction
" Tests for cdo and cfdo
function Test_cdo()
call XdoTests('c')
call XfdoTests('c')
endfunction
" Tests for ldo and lfdo
function Test_ldo()
call XdoTests('l')
call XfdoTests('l')
endfunction
+28
View File
@@ -0,0 +1,28 @@
" Tests for searchpos()
func Test_searchpos()
new one
0put ='1a3'
1put ='123xyz'
call cursor(1, 1)
call assert_equal([1, 1, 2], searchpos('\%(\([a-z]\)\|\_.\)\{-}xyz', 'pcW'))
call cursor(1, 2)
call assert_equal([2, 1, 1], searchpos('\%(\([a-z]\)\|\_.\)\{-}xyz', 'pcW'))
set cpo-=c
call cursor(1, 2)
call assert_equal([1, 2, 2], searchpos('\%(\([a-z]\)\|\_.\)\{-}xyz', 'pcW'))
call cursor(1, 3)
call assert_equal([1, 3, 1], searchpos('\%(\([a-z]\)\|\_.\)\{-}xyz', 'pcW'))
" Now with \zs, first match is in column 0, "a" is matched.
call cursor(1. 3)
call assert_equal([2, 4, 2], searchpos('\%(\([a-z]\)\|\_.\)\{-}\zsxyz', 'pcW'))
" With z flag start at cursor column, don't see the "a".
call cursor(1. 3)
call assert_equal([2, 4, 1], searchpos('\%(\([a-z]\)\|\_.\)\{-}\zsxyz', 'pcWz'))
set cpo+=c
" close the window
q!
endfunc
+20
View File
@@ -756,6 +756,26 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
989,
/**/
988,
/**/
987,
/**/
986,
/**/
985,
/**/
984,
/**/
983,
/**/
982,
/**/
981,
/**/
980,
/**/
979,
/**/
+1
View File
@@ -933,6 +933,7 @@ extern char *(*dyn_libintl_textdomain)(const char *domainname);
#define SEARCH_MARK 0x200 /* set previous context mark */
#define SEARCH_KEEP 0x400 /* keep previous search pattern */
#define SEARCH_PEEK 0x800 /* peek for typed char, cancel search */
#define SEARCH_COL 0x1000 /* start at specified column instead of zero */
/* Values for find_ident_under_cursor() */
#define FIND_IDENT 1 /* find identifier (word) */