mirror of
https://github.com/neovim/neovim.git
synced 2025-11-25 03:30:37 +00:00
Merge pull request #5761 from jamessan/vim-7.4.1752
Catchup with upstream quickfix patches
This commit is contained in:
@@ -1129,6 +1129,7 @@ tag command action ~
|
|||||||
|:caddfile| :caddf[ile] add error message to current quickfix list
|
|:caddfile| :caddf[ile] add error message to current quickfix list
|
||||||
|:call| :cal[l] call a function
|
|:call| :cal[l] call a function
|
||||||
|:catch| :cat[ch] part of a :try command
|
|:catch| :cat[ch] part of a :try command
|
||||||
|
|:cbottom| :cbo[ttom] scroll to the bottom of the quickfix window
|
||||||
|:cbuffer| :cb[uffer] parse error messages and jump to first error
|
|:cbuffer| :cb[uffer] parse error messages and jump to first error
|
||||||
|:cc| :cc go to specific error
|
|:cc| :cc go to specific error
|
||||||
|:cclose| :ccl[ose] close quickfix window
|
|:cclose| :ccl[ose] close quickfix window
|
||||||
@@ -1286,6 +1287,7 @@ tag command action ~
|
|||||||
|:last| :la[st] go to the last file in the argument list
|
|:last| :la[st] go to the last file in the argument list
|
||||||
|:language| :lan[guage] set the language (locale)
|
|:language| :lan[guage] set the language (locale)
|
||||||
|:later| :lat[er] go to newer change, redo
|
|:later| :lat[er] go to newer change, redo
|
||||||
|
|:lbottom| :lbo[ttom] scroll to the bottom of the location window
|
||||||
|:lbuffer| :lb[uffer] parse locations and jump to first location
|
|:lbuffer| :lb[uffer] parse locations and jump to first location
|
||||||
|:lcd| :lc[d] change directory locally
|
|:lcd| :lc[d] change directory locally
|
||||||
|:lchdir| :lch[dir] change directory locally
|
|:lchdir| :lch[dir] change directory locally
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
*quickfix.txt* For Vim version 7.4. Last change: 2016 Jul 01
|
*quickfix.txt* For Vim version 7.4. Last change: 2016 Jul 07
|
||||||
|
|
||||||
|
|
||||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||||
@@ -426,6 +426,17 @@ EXECUTE A COMMAND IN ALL THE BUFFERS IN QUICKFIX OR LOCATION LIST:
|
|||||||
|
|
||||||
*:lw* *:lwindow*
|
*:lw* *:lwindow*
|
||||||
:lw[indow] [height] Same as ":cwindow", except use the window showing the
|
:lw[indow] [height] Same as ":cwindow", except use the window showing the
|
||||||
|
location list for the current window.
|
||||||
|
|
||||||
|
*:cbo* *:cbottom*
|
||||||
|
:cbo[ttom] Put the cursor in the last line of the quickfix window
|
||||||
|
and scroll to make it visible. This is useful for
|
||||||
|
when errors are added by an asynchronous callback.
|
||||||
|
Only call it once in a while if there are many
|
||||||
|
updates to avoid a lot of redrawing.
|
||||||
|
|
||||||
|
*:lbo* *:lbottom*
|
||||||
|
:lbo[ttom] Same as ":cbottom", except use the window showing the
|
||||||
location list for the current window.
|
location list for the current window.
|
||||||
|
|
||||||
Normally the quickfix window is at the bottom of the screen. If there are
|
Normally the quickfix window is at the bottom of the screen. If there are
|
||||||
|
|||||||
@@ -609,6 +609,7 @@ struct file_buffer {
|
|||||||
int b_p_bomb; ///< 'bomb'
|
int b_p_bomb; ///< 'bomb'
|
||||||
char_u *b_p_bh; ///< 'bufhidden'
|
char_u *b_p_bh; ///< 'bufhidden'
|
||||||
char_u *b_p_bt; ///< 'buftype'
|
char_u *b_p_bt; ///< 'buftype'
|
||||||
|
bool b_has_qf_entry; ///< quickfix exists for buffer
|
||||||
int b_p_bl; ///< 'buflisted'
|
int b_p_bl; ///< 'buflisted'
|
||||||
int b_p_cin; ///< 'cindent'
|
int b_p_cin; ///< 'cindent'
|
||||||
char_u *b_p_cino; ///< 'cinoptions'
|
char_u *b_p_cino; ///< 'cinoptions'
|
||||||
@@ -1036,11 +1037,11 @@ struct window_S {
|
|||||||
*/
|
*/
|
||||||
int w_wrow, w_wcol; /* cursor position in window */
|
int w_wrow, w_wcol; /* cursor position in window */
|
||||||
|
|
||||||
linenr_T w_botline; /* number of the line below the bottom of
|
linenr_T w_botline; // number of the line below the bottom of
|
||||||
the screen */
|
// the window
|
||||||
int w_empty_rows; /* number of ~ rows in window */
|
int w_empty_rows; // number of ~ rows in window
|
||||||
int w_filler_rows; /* number of filler rows at the end of the
|
int w_filler_rows; // number of filler rows at the end of the
|
||||||
window */
|
// window
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Info about the lines currently in the window is remembered to avoid
|
* Info about the lines currently in the window is remembered to avoid
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ static char *e_listdictarg = N_(
|
|||||||
static char *e_emptykey = N_("E713: Cannot use empty key for Dictionary");
|
static char *e_emptykey = N_("E713: Cannot use empty key for Dictionary");
|
||||||
static char *e_listreq = N_("E714: List required");
|
static char *e_listreq = N_("E714: List required");
|
||||||
static char *e_dictreq = N_("E715: Dictionary required");
|
static char *e_dictreq = N_("E715: Dictionary required");
|
||||||
static char *e_strreq = N_("E114: String required");
|
static char *e_stringreq = N_("E928: String required");
|
||||||
static char *e_toomanyarg = N_("E118: Too many arguments for function: %s");
|
static char *e_toomanyarg = N_("E118: Too many arguments for function: %s");
|
||||||
static char *e_dictkey = N_("E716: Key not present in Dictionary: %s");
|
static char *e_dictkey = N_("E716: Key not present in Dictionary: %s");
|
||||||
static char *e_funcexts = N_(
|
static char *e_funcexts = N_(
|
||||||
@@ -14996,6 +14996,7 @@ static void f_setline(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
|||||||
static void set_qf_ll_list(win_T *wp, typval_T *args, typval_T *rettv)
|
static void set_qf_ll_list(win_T *wp, typval_T *args, typval_T *rettv)
|
||||||
FUNC_ATTR_NONNULL_ARG(2, 3)
|
FUNC_ATTR_NONNULL_ARG(2, 3)
|
||||||
{
|
{
|
||||||
|
static char *e_invact = N_("E927: Invalid action: '%s'");
|
||||||
char_u *title = NULL;
|
char_u *title = NULL;
|
||||||
int action = ' ';
|
int action = ' ';
|
||||||
rettv->vval.v_number = -1;
|
rettv->vval.v_number = -1;
|
||||||
@@ -15011,12 +15012,15 @@ static void set_qf_ll_list(win_T *wp, typval_T *args, typval_T *rettv)
|
|||||||
// Option argument was not given.
|
// Option argument was not given.
|
||||||
goto skip_args;
|
goto skip_args;
|
||||||
} else if (action_arg->v_type != VAR_STRING) {
|
} else if (action_arg->v_type != VAR_STRING) {
|
||||||
EMSG(_(e_strreq));
|
EMSG(_(e_stringreq));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
char_u *act = get_tv_string_chk(action_arg);
|
char_u *act = get_tv_string_chk(action_arg);
|
||||||
if (*act == 'a' || *act == 'r') {
|
if ((*act == 'a' || *act == 'r' || *act == ' ') && act[1] == NUL) {
|
||||||
action = *act;
|
action = *act;
|
||||||
|
} else {
|
||||||
|
EMSG2(_(e_invact), act);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
typval_T *title_arg = &args[2];
|
typval_T *title_arg = &args[2];
|
||||||
|
|||||||
@@ -357,6 +357,12 @@ return {
|
|||||||
addr_type=ADDR_LINES,
|
addr_type=ADDR_LINES,
|
||||||
func='ex_cbuffer',
|
func='ex_cbuffer',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
command='cbottom',
|
||||||
|
flags=bit.bor(TRLBAR),
|
||||||
|
addr_type=ADDR_LINES,
|
||||||
|
func='ex_cbottom',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
command='cc',
|
command='cc',
|
||||||
flags=bit.bor(RANGE, NOTADR, COUNT, TRLBAR, BANG),
|
flags=bit.bor(RANGE, NOTADR, COUNT, TRLBAR, BANG),
|
||||||
@@ -1271,6 +1277,12 @@ return {
|
|||||||
addr_type=ADDR_LINES,
|
addr_type=ADDR_LINES,
|
||||||
func='ex_cbuffer',
|
func='ex_cbuffer',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
command='lbottom',
|
||||||
|
flags=bit.bor(TRLBAR),
|
||||||
|
addr_type=ADDR_LINES,
|
||||||
|
func='ex_cbottom',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
command='lcd',
|
command='lcd',
|
||||||
flags=bit.bor(BANG, FILE1, TRLBAR, CMDWIN),
|
flags=bit.bor(BANG, FILE1, TRLBAR, CMDWIN),
|
||||||
|
|||||||
@@ -564,8 +564,8 @@ msgstr "E714: Потрібен список"
|
|||||||
msgid "E715: Dictionary required"
|
msgid "E715: Dictionary required"
|
||||||
msgstr "E715: Потрібен словник"
|
msgstr "E715: Потрібен словник"
|
||||||
|
|
||||||
msgid "E114: String required"
|
msgid "E928: String required"
|
||||||
msgstr "E114: Потрібен String"
|
msgstr "E928: Потрібен String"
|
||||||
|
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "E118: Too many arguments for function: %s"
|
msgid "E118: Too many arguments for function: %s"
|
||||||
|
|||||||
1253
src/nvim/quickfix.c
1253
src/nvim/quickfix.c
File diff suppressed because it is too large
Load Diff
@@ -30,8 +30,8 @@ SCRIPTS := \
|
|||||||
# Tests using runtest.vim.vim.
|
# Tests using runtest.vim.vim.
|
||||||
# Keep test_alot*.res as the last one, sort the others.
|
# Keep test_alot*.res as the last one, sort the others.
|
||||||
NEW_TESTS = \
|
NEW_TESTS = \
|
||||||
test_cscope.res \
|
|
||||||
test_cmdline.res \
|
test_cmdline.res \
|
||||||
|
test_cscope.res \
|
||||||
test_diffmode.res \
|
test_diffmode.res \
|
||||||
test_hardcopy.res \
|
test_hardcopy.res \
|
||||||
test_help_tagjump.res \
|
test_help_tagjump.res \
|
||||||
@@ -39,6 +39,7 @@ NEW_TESTS = \
|
|||||||
test_langmap.res \
|
test_langmap.res \
|
||||||
test_match.res \
|
test_match.res \
|
||||||
test_matchadd_conceal.res \
|
test_matchadd_conceal.res \
|
||||||
|
test_quickfix.res \
|
||||||
test_syntax.res \
|
test_syntax.res \
|
||||||
test_usercommands.res \
|
test_usercommands.res \
|
||||||
test_timers.res \
|
test_timers.res \
|
||||||
|
|||||||
4
src/nvim/testdir/samples/quickfix.txt
Normal file
4
src/nvim/testdir/samples/quickfix.txt
Normal file
File diff suppressed because one or more lines are too long
1422
src/nvim/testdir/test_quickfix.vim
Normal file
1422
src/nvim/testdir/test_quickfix.vim
Normal file
File diff suppressed because it is too large
Load Diff
@@ -430,7 +430,7 @@ static int included_patches[] = {
|
|||||||
2013,
|
2013,
|
||||||
2012,
|
2012,
|
||||||
2011,
|
2011,
|
||||||
// 2010,
|
2010,
|
||||||
// 2009,
|
// 2009,
|
||||||
// 2008,
|
// 2008,
|
||||||
2007,
|
2007,
|
||||||
@@ -443,7 +443,7 @@ static int included_patches[] = {
|
|||||||
// 2000,
|
// 2000,
|
||||||
// 1999,
|
// 1999,
|
||||||
// 1998 NA
|
// 1998 NA
|
||||||
// 1997,
|
1997,
|
||||||
// 1996,
|
// 1996,
|
||||||
// 1995 NA
|
// 1995 NA
|
||||||
// 1994,
|
// 1994,
|
||||||
@@ -456,11 +456,11 @@ static int included_patches[] = {
|
|||||||
// 1987 NA
|
// 1987 NA
|
||||||
// 1986,
|
// 1986,
|
||||||
// 1985 NA
|
// 1985 NA
|
||||||
// 1984,
|
1984,
|
||||||
// 1983 NA
|
// 1983 NA
|
||||||
// 1982 NA
|
// 1982 NA
|
||||||
// 1981,
|
// 1981,
|
||||||
// 1980,
|
1980,
|
||||||
// 1979,
|
// 1979,
|
||||||
// 1978,
|
// 1978,
|
||||||
// 1977,
|
// 1977,
|
||||||
@@ -474,9 +474,9 @@ static int included_patches[] = {
|
|||||||
// 1969 NA
|
// 1969 NA
|
||||||
// 1968,
|
// 1968,
|
||||||
1967,
|
1967,
|
||||||
// 1966,
|
1966,
|
||||||
// 1965 NA
|
// 1965 NA
|
||||||
// 1964,
|
1964,
|
||||||
// 1963 NA
|
// 1963 NA
|
||||||
// 1962,
|
// 1962,
|
||||||
1961,
|
1961,
|
||||||
@@ -487,11 +487,11 @@ static int included_patches[] = {
|
|||||||
1956,
|
1956,
|
||||||
// 1955,
|
// 1955,
|
||||||
// 1954,
|
// 1954,
|
||||||
// 1953,
|
1953,
|
||||||
1952,
|
1952,
|
||||||
// 1951 NA
|
// 1951 NA
|
||||||
// 1950,
|
1950,
|
||||||
// 1949,
|
1949,
|
||||||
// 1948,
|
// 1948,
|
||||||
// 1947 NA
|
// 1947 NA
|
||||||
// 1946 NA
|
// 1946 NA
|
||||||
@@ -499,11 +499,11 @@ static int included_patches[] = {
|
|||||||
// 1944 NA
|
// 1944 NA
|
||||||
// 1943 NA
|
// 1943 NA
|
||||||
// 1942 NA
|
// 1942 NA
|
||||||
// 1941,
|
1941,
|
||||||
// 1940,
|
// 1940,
|
||||||
// 1939 NA
|
// 1939 NA
|
||||||
// 1938 NA
|
// 1938 NA
|
||||||
// 1937,
|
1937,
|
||||||
// 1936,
|
// 1936,
|
||||||
// 1935 NA
|
// 1935 NA
|
||||||
// 1934 NA
|
// 1934 NA
|
||||||
@@ -528,7 +528,7 @@ static int included_patches[] = {
|
|||||||
// 1915 NA
|
// 1915 NA
|
||||||
// 1914,
|
// 1914,
|
||||||
1913,
|
1913,
|
||||||
// 1912,
|
1912,
|
||||||
// 1911,
|
// 1911,
|
||||||
// 1910,
|
// 1910,
|
||||||
1909,
|
1909,
|
||||||
@@ -556,10 +556,10 @@ static int included_patches[] = {
|
|||||||
// 1887 NA
|
// 1887 NA
|
||||||
// 1886 NA
|
// 1886 NA
|
||||||
// 1885 NA
|
// 1885 NA
|
||||||
// 1884,
|
1884,
|
||||||
// 1883 NA
|
// 1883 NA
|
||||||
// 1882,
|
1882,
|
||||||
// 1881,
|
1881,
|
||||||
// 1880 NA
|
// 1880 NA
|
||||||
// 1879 NA
|
// 1879 NA
|
||||||
// 1878 NA
|
// 1878 NA
|
||||||
@@ -569,7 +569,7 @@ static int included_patches[] = {
|
|||||||
// 1874 NA
|
// 1874 NA
|
||||||
// 1873 NA
|
// 1873 NA
|
||||||
// 1872 NA
|
// 1872 NA
|
||||||
// 1871,
|
1871,
|
||||||
// 1870 NA
|
// 1870 NA
|
||||||
// 1869 NA
|
// 1869 NA
|
||||||
// 1868,
|
// 1868,
|
||||||
@@ -599,7 +599,7 @@ static int included_patches[] = {
|
|||||||
// 1844,
|
// 1844,
|
||||||
// 1843 NA
|
// 1843 NA
|
||||||
1842,
|
1842,
|
||||||
// 1841,
|
1841,
|
||||||
1840,
|
1840,
|
||||||
// 1839,
|
// 1839,
|
||||||
// 1838,
|
// 1838,
|
||||||
@@ -616,7 +616,7 @@ static int included_patches[] = {
|
|||||||
// 1826 NA
|
// 1826 NA
|
||||||
// 1825 NA
|
// 1825 NA
|
||||||
// 1824 NA
|
// 1824 NA
|
||||||
// 1823,
|
1823,
|
||||||
// 1822 NA
|
// 1822 NA
|
||||||
1821,
|
1821,
|
||||||
1820,
|
1820,
|
||||||
@@ -624,9 +624,9 @@ static int included_patches[] = {
|
|||||||
1818,
|
1818,
|
||||||
// 1817 NA
|
// 1817 NA
|
||||||
1816,
|
1816,
|
||||||
// 1815,
|
1815,
|
||||||
// 1814 NA
|
// 1814 NA
|
||||||
// 1813,
|
1813,
|
||||||
// 1812,
|
// 1812,
|
||||||
// 1811 NA
|
// 1811 NA
|
||||||
// 1810 NA
|
// 1810 NA
|
||||||
@@ -637,7 +637,7 @@ static int included_patches[] = {
|
|||||||
// 1805 NA
|
// 1805 NA
|
||||||
// 1804 NA
|
// 1804 NA
|
||||||
// 1803 NA
|
// 1803 NA
|
||||||
// 1802,
|
1802,
|
||||||
// 1801 NA
|
// 1801 NA
|
||||||
// 1800 NA
|
// 1800 NA
|
||||||
1799,
|
1799,
|
||||||
@@ -672,7 +672,7 @@ static int included_patches[] = {
|
|||||||
// 1771 NA
|
// 1771 NA
|
||||||
// 1770 NA
|
// 1770 NA
|
||||||
// 1769,
|
// 1769,
|
||||||
// 1768,
|
1768,
|
||||||
// 1767 NA
|
// 1767 NA
|
||||||
// 1766 NA
|
// 1766 NA
|
||||||
1765,
|
1765,
|
||||||
@@ -689,7 +689,7 @@ static int included_patches[] = {
|
|||||||
1754,
|
1754,
|
||||||
1753,
|
1753,
|
||||||
// 1753,
|
// 1753,
|
||||||
// 1752,
|
1752,
|
||||||
1751,
|
1751,
|
||||||
// 1750 NA
|
// 1750 NA
|
||||||
// 1749 NA
|
// 1749 NA
|
||||||
|
|||||||
@@ -1,683 +0,0 @@
|
|||||||
-- Test for the quickfix commands.
|
|
||||||
|
|
||||||
local helpers = require('test.functional.helpers')(after_each)
|
|
||||||
local source, clear = helpers.source, helpers.clear
|
|
||||||
local eq, nvim, call = helpers.eq, helpers.meths, helpers.call
|
|
||||||
local eval = helpers.eval
|
|
||||||
local execute = helpers.execute
|
|
||||||
|
|
||||||
local function expected_empty()
|
|
||||||
eq({}, nvim.get_vvar('errors'))
|
|
||||||
end
|
|
||||||
|
|
||||||
describe('helpgrep', function()
|
|
||||||
before_each(function()
|
|
||||||
clear()
|
|
||||||
|
|
||||||
source([[
|
|
||||||
" Tests for the :clist and :llist commands
|
|
||||||
function XlistTests(cchar)
|
|
||||||
let Xlist = a:cchar . 'list'
|
|
||||||
let Xgetexpr = a:cchar . 'getexpr'
|
|
||||||
|
|
||||||
" With an empty list, command should return error
|
|
||||||
exe Xgetexpr . ' []'
|
|
||||||
exe 'silent! ' . Xlist
|
|
||||||
call assert_true(v:errmsg ==# 'E42: No Errors')
|
|
||||||
|
|
||||||
" 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']"
|
|
||||||
|
|
||||||
" List only valid entries
|
|
||||||
redir => result
|
|
||||||
exe 'silent ' . Xlist
|
|
||||||
redir END
|
|
||||||
let l = split(result, "\n")
|
|
||||||
call assert_equal([' 2 Xtestfile1:1 col 3: Line1',
|
|
||||||
\ ' 4 Xtestfile2:2 col 2: Line2',
|
|
||||||
\ ' 6 Xtestfile3:3 col 1: Line3'], l)
|
|
||||||
|
|
||||||
" List all the entries
|
|
||||||
redir => result
|
|
||||||
exe 'silent ' . Xlist . "!"
|
|
||||||
redir END
|
|
||||||
let l = split(result, "\n")
|
|
||||||
call assert_equal([' 1: non-error 1', ' 2 Xtestfile1:1 col 3: Line1',
|
|
||||||
\ ' 3: non-error 2', ' 4 Xtestfile2:2 col 2: Line2',
|
|
||||||
\ ' 5: non-error 3', ' 6 Xtestfile3:3 col 1: Line3'], l)
|
|
||||||
|
|
||||||
" List a range of errors
|
|
||||||
redir => result
|
|
||||||
exe 'silent '. Xlist . " 3,6"
|
|
||||||
redir END
|
|
||||||
let l = split(result, "\n")
|
|
||||||
call assert_equal([' 4 Xtestfile2:2 col 2: Line2',
|
|
||||||
\ ' 6 Xtestfile3:3 col 1: Line3'], l)
|
|
||||||
|
|
||||||
redir => result
|
|
||||||
exe 'silent ' . Xlist . "! 3,4"
|
|
||||||
redir END
|
|
||||||
let l = split(result, "\n")
|
|
||||||
call assert_equal([' 3: non-error 2', ' 4 Xtestfile2:2 col 2: Line2'], l)
|
|
||||||
|
|
||||||
redir => result
|
|
||||||
exe 'silent ' . Xlist . " -6,-4"
|
|
||||||
redir END
|
|
||||||
let l = split(result, "\n")
|
|
||||||
call assert_equal([' 2 Xtestfile1:1 col 3: Line1'], l)
|
|
||||||
|
|
||||||
redir => result
|
|
||||||
exe 'silent ' . Xlist . "! -5,-3"
|
|
||||||
redir END
|
|
||||||
let l = split(result, "\n")
|
|
||||||
call assert_equal([' 2 Xtestfile1:1 col 3: Line1',
|
|
||||||
\ ' 3: non-error 2', ' 4 Xtestfile2:2 col 2: Line2'], l)
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" Tests for the :colder, :cnewer, :lolder and :lnewer commands
|
|
||||||
" Note that this test assumes that a quickfix/location list is
|
|
||||||
" already set by the caller
|
|
||||||
function XageTests(cchar)
|
|
||||||
let Xolder = a:cchar . 'older'
|
|
||||||
let Xnewer = a:cchar . 'newer'
|
|
||||||
let Xgetexpr = a:cchar . 'getexpr'
|
|
||||||
if a:cchar == 'c'
|
|
||||||
let Xgetlist = 'getqflist()'
|
|
||||||
else
|
|
||||||
let Xgetlist = 'getloclist(0)'
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Jumping to a non existent list should return error
|
|
||||||
exe 'silent! ' . Xolder . ' 99'
|
|
||||||
call assert_true(v:errmsg ==# 'E380: At bottom of quickfix stack')
|
|
||||||
|
|
||||||
exe 'silent! ' . Xnewer . ' 99'
|
|
||||||
call assert_true(v:errmsg ==# 'E381: At top of quickfix stack')
|
|
||||||
|
|
||||||
" Add three quickfix/location lists
|
|
||||||
exe Xgetexpr . " ['Xtestfile1:1:3:Line1']"
|
|
||||||
exe Xgetexpr . " ['Xtestfile2:2:2:Line2']"
|
|
||||||
exe Xgetexpr . " ['Xtestfile3:3:1:Line3']"
|
|
||||||
|
|
||||||
" Go back two lists
|
|
||||||
exe Xolder
|
|
||||||
exe 'let l = ' . Xgetlist
|
|
||||||
call assert_equal('Line2', l[0].text)
|
|
||||||
|
|
||||||
" Go forward two lists
|
|
||||||
exe Xnewer
|
|
||||||
exe 'let l = ' . Xgetlist
|
|
||||||
call assert_equal('Line3', l[0].text)
|
|
||||||
|
|
||||||
" Test for the optional count argument
|
|
||||||
exe Xolder . ' 2'
|
|
||||||
exe 'let l = ' . Xgetlist
|
|
||||||
call assert_equal('Line1', l[0].text)
|
|
||||||
|
|
||||||
exe Xnewer . ' 2'
|
|
||||||
exe 'let l = ' . Xgetlist
|
|
||||||
call assert_equal('Line3', l[0].text)
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" Tests for the :cwindow, :lwindow :cclose, :lclose, :copen and :lopen
|
|
||||||
" commands
|
|
||||||
function XwindowTests(cchar)
|
|
||||||
let Xwindow = a:cchar . 'window'
|
|
||||||
let Xclose = a:cchar . 'close'
|
|
||||||
let Xopen = a:cchar . 'open'
|
|
||||||
let Xgetexpr = a:cchar . 'getexpr'
|
|
||||||
|
|
||||||
" Create a list with no valid entries
|
|
||||||
exe Xgetexpr . " ['non-error 1', 'non-error 2', 'non-error 3']"
|
|
||||||
|
|
||||||
" Quickfix/Location window should not open with no valid errors
|
|
||||||
exe Xwindow
|
|
||||||
call assert_true(winnr('$') == 1)
|
|
||||||
|
|
||||||
" Create a list with valid entries
|
|
||||||
exe Xgetexpr . " ['Xtestfile1:1:3:Line1', 'Xtestfile2:2:2:Line2',
|
|
||||||
\ 'Xtestfile3:3:1:Line3']"
|
|
||||||
|
|
||||||
" Open the window
|
|
||||||
exe Xwindow
|
|
||||||
call assert_true(winnr('$') == 2 && winnr() == 2 &&
|
|
||||||
\ getline('.') ==# 'Xtestfile1|1 col 3| Line1')
|
|
||||||
|
|
||||||
" Close the window
|
|
||||||
exe Xclose
|
|
||||||
call assert_true(winnr('$') == 1)
|
|
||||||
|
|
||||||
" Create a list with no valid entries
|
|
||||||
exe Xgetexpr . " ['non-error 1', 'non-error 2', 'non-error 3']"
|
|
||||||
|
|
||||||
" Open the window
|
|
||||||
exe Xopen . ' 5'
|
|
||||||
call assert_true(winnr('$') == 2 && getline('.') ==# '|| non-error 1'
|
|
||||||
\ && winheight('.') == 5)
|
|
||||||
|
|
||||||
" Opening the window again, should move the cursor to that window
|
|
||||||
wincmd t
|
|
||||||
exe Xopen . ' 7'
|
|
||||||
call assert_true(winnr('$') == 2 && winnr() == 2 &&
|
|
||||||
\ winheight('.') == 7 &&
|
|
||||||
\ getline('.') ==# '|| non-error 1')
|
|
||||||
|
|
||||||
|
|
||||||
" Calling cwindow should close the quickfix window with no valid errors
|
|
||||||
exe Xwindow
|
|
||||||
call assert_true(winnr('$') == 1)
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" Tests for the :cfile, :lfile, :caddfile, :laddfile, :cgetfile and :lgetfile
|
|
||||||
" commands.
|
|
||||||
function XfileTests(cchar)
|
|
||||||
let Xfile = a:cchar . 'file'
|
|
||||||
let Xgetfile = a:cchar . 'getfile'
|
|
||||||
let Xaddfile = a:cchar . 'addfile'
|
|
||||||
if a:cchar == 'c'
|
|
||||||
let Xgetlist = 'getqflist()'
|
|
||||||
else
|
|
||||||
let Xgetlist = 'getloclist(0)'
|
|
||||||
endif
|
|
||||||
|
|
||||||
call writefile(['Xtestfile1:700:10:Line 700',
|
|
||||||
\ 'Xtestfile2:800:15:Line 800'], 'Xqftestfile1')
|
|
||||||
|
|
||||||
enew!
|
|
||||||
exe Xfile . ' Xqftestfile1'
|
|
||||||
exe 'let l = ' . Xgetlist
|
|
||||||
call assert_true(len(l) == 2 &&
|
|
||||||
\ l[0].lnum == 700 && l[0].col == 10 && l[0].text ==# 'Line 700' &&
|
|
||||||
\ l[1].lnum == 800 && l[1].col == 15 && l[1].text ==# 'Line 800')
|
|
||||||
|
|
||||||
" Run cfile/lfile from a modified buffer
|
|
||||||
enew!
|
|
||||||
silent! put ='Quickfix'
|
|
||||||
exe 'silent! ' . Xfile . ' Xqftestfile1'
|
|
||||||
call assert_true(v:errmsg ==# 'E37: No write since last change (add ! to override)')
|
|
||||||
|
|
||||||
call writefile(['Xtestfile3:900:30:Line 900'], 'Xqftestfile1')
|
|
||||||
exe Xaddfile . ' Xqftestfile1'
|
|
||||||
exe 'let l = ' . Xgetlist
|
|
||||||
call assert_true(len(l) == 3 &&
|
|
||||||
\ l[2].lnum == 900 && l[2].col == 30 && l[2].text ==# 'Line 900')
|
|
||||||
|
|
||||||
call writefile(['Xtestfile1:222:77:Line 222',
|
|
||||||
\ 'Xtestfile2:333:88:Line 333'], 'Xqftestfile1')
|
|
||||||
|
|
||||||
enew!
|
|
||||||
exe Xgetfile . ' Xqftestfile1'
|
|
||||||
exe 'let l = ' . Xgetlist
|
|
||||||
call assert_true(len(l) == 2 &&
|
|
||||||
\ l[0].lnum == 222 && l[0].col == 77 && l[0].text ==# 'Line 222' &&
|
|
||||||
\ l[1].lnum == 333 && l[1].col == 88 && l[1].text ==# 'Line 333')
|
|
||||||
|
|
||||||
call delete('Xqftestfile1')
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" Tests for the :cbuffer, :lbuffer, :caddbuffer, :laddbuffer, :cgetbuffer and
|
|
||||||
" :lgetbuffer commands.
|
|
||||||
function XbufferTests(cchar)
|
|
||||||
let Xbuffer = a:cchar . 'buffer'
|
|
||||||
let Xgetbuffer = a:cchar . 'getbuffer'
|
|
||||||
let Xaddbuffer = a:cchar . 'addbuffer'
|
|
||||||
if a:cchar == 'c'
|
|
||||||
let Xgetlist = 'getqflist()'
|
|
||||||
else
|
|
||||||
let Xgetlist = 'getloclist(0)'
|
|
||||||
endif
|
|
||||||
|
|
||||||
enew!
|
|
||||||
silent! call setline(1, ['Xtestfile7:700:10:Line 700',
|
|
||||||
\ 'Xtestfile8:800:15:Line 800'])
|
|
||||||
exe Xbuffer . "!"
|
|
||||||
exe 'let l = ' . Xgetlist
|
|
||||||
call assert_true(len(l) == 2 &&
|
|
||||||
\ l[0].lnum == 700 && l[0].col == 10 && l[0].text ==# 'Line 700' &&
|
|
||||||
\ l[1].lnum == 800 && l[1].col == 15 && l[1].text ==# 'Line 800')
|
|
||||||
|
|
||||||
enew!
|
|
||||||
silent! call setline(1, ['Xtestfile9:900:55:Line 900',
|
|
||||||
\ 'Xtestfile10:950:66:Line 950'])
|
|
||||||
exe Xgetbuffer
|
|
||||||
exe 'let l = ' . Xgetlist
|
|
||||||
call assert_true(len(l) == 2 &&
|
|
||||||
\ l[0].lnum == 900 && l[0].col == 55 && l[0].text ==# 'Line 900' &&
|
|
||||||
\ l[1].lnum == 950 && l[1].col == 66 && l[1].text ==# 'Line 950')
|
|
||||||
|
|
||||||
enew!
|
|
||||||
silent! call setline(1, ['Xtestfile11:700:20:Line 700',
|
|
||||||
\ 'Xtestfile12:750:25:Line 750'])
|
|
||||||
exe Xaddbuffer
|
|
||||||
exe 'let l = ' . Xgetlist
|
|
||||||
call assert_true(len(l) == 4 &&
|
|
||||||
\ l[1].lnum == 950 && l[1].col == 66 && l[1].text ==# 'Line 950' &&
|
|
||||||
\ l[2].lnum == 700 && l[2].col == 20 && l[2].text ==# 'Line 700' &&
|
|
||||||
\ l[3].lnum == 750 && l[3].col == 25 && l[3].text ==# 'Line 750')
|
|
||||||
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function Test_locationlist_curwin_was_closed()
|
|
||||||
augroup testgroup
|
|
||||||
au!
|
|
||||||
autocmd BufReadCmd t call R(expand("<amatch>"))
|
|
||||||
augroup END
|
|
||||||
|
|
||||||
function! R(n)
|
|
||||||
quit
|
|
||||||
endfunc
|
|
||||||
|
|
||||||
new
|
|
||||||
let q = []
|
|
||||||
call add(q, {'filename': 't' })
|
|
||||||
call setloclist(0, q)
|
|
||||||
call assert_fails('lrewind', 'E924:')
|
|
||||||
|
|
||||||
augroup! testgroup
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" This will test for problems in quickfix:
|
|
||||||
" A. incorrectly copying location lists which caused the location list to show
|
|
||||||
" a different name than the file that was actually being displayed.
|
|
||||||
" B. not reusing the window for which the location list window is opened but
|
|
||||||
" instead creating new windows.
|
|
||||||
" C. make sure that the location list window is not reused instead of the
|
|
||||||
" window it belongs to.
|
|
||||||
"
|
|
||||||
" Set up the test environment:
|
|
||||||
function! ReadTestProtocol(name)
|
|
||||||
let base = substitute(a:name, '\v^test://(.*)%(\.[^.]+)?', '\1', '')
|
|
||||||
let word = substitute(base, '\v(.*)\..*', '\1', '')
|
|
||||||
|
|
||||||
setl modifiable
|
|
||||||
setl noreadonly
|
|
||||||
setl noswapfile
|
|
||||||
setl bufhidden=delete
|
|
||||||
%del _
|
|
||||||
" For problem 2:
|
|
||||||
" 'buftype' has to be set to reproduce the constant opening of new windows
|
|
||||||
setl buftype=nofile
|
|
||||||
|
|
||||||
call setline(1, word)
|
|
||||||
|
|
||||||
setl nomodified
|
|
||||||
setl nomodifiable
|
|
||||||
setl readonly
|
|
||||||
exe 'doautocmd BufRead ' . substitute(a:name, '\v^test://(.*)', '\1', '')
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function Test_locationlist()
|
|
||||||
enew
|
|
||||||
|
|
||||||
augroup testgroup
|
|
||||||
au!
|
|
||||||
autocmd BufReadCmd test://* call ReadTestProtocol(expand("<amatch>"))
|
|
||||||
augroup END
|
|
||||||
|
|
||||||
let words = [ "foo", "bar", "baz", "quux", "shmoo", "spam", "eggs" ]
|
|
||||||
|
|
||||||
let qflist = []
|
|
||||||
for word in words
|
|
||||||
call add(qflist, {'filename': 'test://' . word . '.txt', 'text': 'file ' . word . '.txt', })
|
|
||||||
" NOTE: problem 1:
|
|
||||||
" intentionally not setting 'lnum' so that the quickfix entries are not
|
|
||||||
" valid
|
|
||||||
call setloclist(0, qflist, ' ')
|
|
||||||
endfor
|
|
||||||
|
|
||||||
" Test A
|
|
||||||
lrewind
|
|
||||||
enew
|
|
||||||
lopen
|
|
||||||
lnext
|
|
||||||
lnext
|
|
||||||
lnext
|
|
||||||
lnext
|
|
||||||
vert split
|
|
||||||
wincmd L
|
|
||||||
lopen
|
|
||||||
wincmd p
|
|
||||||
lnext
|
|
||||||
let fileName = expand("%")
|
|
||||||
wincmd p
|
|
||||||
let locationListFileName = substitute(getline(line('.')), '\([^|]*\)|.*', '\1', '')
|
|
||||||
let fileName = substitute(fileName, '\\', '/', 'g')
|
|
||||||
let locationListFileName = substitute(locationListFileName, '\\', '/', 'g')
|
|
||||||
call assert_equal("test://bar.txt", fileName)
|
|
||||||
call assert_equal("test://bar.txt", locationListFileName)
|
|
||||||
|
|
||||||
wincmd n | only
|
|
||||||
|
|
||||||
" Test B:
|
|
||||||
lrewind
|
|
||||||
lopen
|
|
||||||
2
|
|
||||||
exe "normal \<CR>"
|
|
||||||
wincmd p
|
|
||||||
3
|
|
||||||
exe "normal \<CR>"
|
|
||||||
wincmd p
|
|
||||||
4
|
|
||||||
exe "normal \<CR>"
|
|
||||||
call assert_equal(2, winnr('$'))
|
|
||||||
wincmd n | only
|
|
||||||
|
|
||||||
" Test C:
|
|
||||||
lrewind
|
|
||||||
lopen
|
|
||||||
" Let's move the location list window to the top to check whether it (the
|
|
||||||
" first window found) will be reused when we try to open new windows:
|
|
||||||
wincmd K
|
|
||||||
2
|
|
||||||
exe "normal \<CR>"
|
|
||||||
wincmd p
|
|
||||||
3
|
|
||||||
exe "normal \<CR>"
|
|
||||||
wincmd p
|
|
||||||
4
|
|
||||||
exe "normal \<CR>"
|
|
||||||
1wincmd w
|
|
||||||
call assert_equal('quickfix', &buftype)
|
|
||||||
2wincmd w
|
|
||||||
let bufferName = expand("%")
|
|
||||||
let bufferName = substitute(bufferName, '\\', '/', 'g')
|
|
||||||
call assert_equal('test://quux.txt', bufferName)
|
|
||||||
|
|
||||||
wincmd n | only
|
|
||||||
|
|
||||||
augroup! testgroup
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
func Test_vimgreptitle()
|
|
||||||
augroup QfBufWinEnter
|
|
||||||
au!
|
|
||||||
au BufWinEnter * :let g:a=get(w:, 'quickfix_title', 'NONE')
|
|
||||||
augroup END
|
|
||||||
try
|
|
||||||
vimgrep /pattern/j file
|
|
||||||
catch /E480/
|
|
||||||
endtry
|
|
||||||
copen
|
|
||||||
call assert_equal(': vimgrep /pattern/j file', g:a)
|
|
||||||
augroup QfBufWinEnter
|
|
||||||
au!
|
|
||||||
augroup END
|
|
||||||
augroup! QfBufWinEnter
|
|
||||||
endfunc
|
|
||||||
|
|
||||||
function XquickfixChangedByAutocmd(cchar)
|
|
||||||
let Xolder = a:cchar . 'older'
|
|
||||||
let Xgetexpr = a:cchar . 'getexpr'
|
|
||||||
let Xrewind = a:cchar . 'rewind'
|
|
||||||
if a:cchar == 'c'
|
|
||||||
let Xsetlist = 'setqflist('
|
|
||||||
let ErrorNr = 'E925'
|
|
||||||
function! ReadFunc()
|
|
||||||
colder
|
|
||||||
cgetexpr []
|
|
||||||
endfunc
|
|
||||||
else
|
|
||||||
let Xsetlist = 'setloclist(0,'
|
|
||||||
let ErrorNr = 'E926'
|
|
||||||
function! ReadFunc()
|
|
||||||
lolder
|
|
||||||
lgetexpr []
|
|
||||||
endfunc
|
|
||||||
endif
|
|
||||||
|
|
||||||
augroup testgroup
|
|
||||||
au!
|
|
||||||
autocmd BufReadCmd t call ReadFunc()
|
|
||||||
augroup END
|
|
||||||
|
|
||||||
bwipe!
|
|
||||||
let words = [ "a", "b" ]
|
|
||||||
let qflist = []
|
|
||||||
for word in words
|
|
||||||
call add(qflist, {'filename': 't'})
|
|
||||||
exec "call " . Xsetlist . "qflist, '')"
|
|
||||||
endfor
|
|
||||||
exec "call assert_fails('" . Xrewind . "', '" . ErrorNr . ":')"
|
|
||||||
|
|
||||||
augroup! testgroup
|
|
||||||
endfunc
|
|
||||||
|
|
||||||
func Test_caddbuffer_to_empty()
|
|
||||||
helpgr quickfix
|
|
||||||
call setqflist([], 'r')
|
|
||||||
cad
|
|
||||||
try
|
|
||||||
silent cn
|
|
||||||
catch
|
|
||||||
" number of matches is unknown
|
|
||||||
call assert_true(v:exception =~ 'E553:')
|
|
||||||
endtry
|
|
||||||
quit!
|
|
||||||
endfunc
|
|
||||||
]])
|
|
||||||
end)
|
|
||||||
|
|
||||||
it('copen/cclose work', function()
|
|
||||||
source([[
|
|
||||||
helpgrep quickfix
|
|
||||||
copen
|
|
||||||
" This wipes out the buffer, make sure that doesn't cause trouble.
|
|
||||||
cclose
|
|
||||||
]])
|
|
||||||
end)
|
|
||||||
|
|
||||||
it('clist/llist work', function()
|
|
||||||
call('XlistTests', 'c')
|
|
||||||
expected_empty()
|
|
||||||
call('XlistTests', 'l')
|
|
||||||
expected_empty()
|
|
||||||
end)
|
|
||||||
|
|
||||||
it('colder/cnewer and lolder/lnewer work', function()
|
|
||||||
local list = {{bufnr = 1, lnum = 1}}
|
|
||||||
call('setqflist', list)
|
|
||||||
call('XageTests', 'c')
|
|
||||||
expected_empty()
|
|
||||||
|
|
||||||
call('setloclist', 0, list)
|
|
||||||
call('XageTests', 'l')
|
|
||||||
expected_empty()
|
|
||||||
end)
|
|
||||||
|
|
||||||
it('quickfix/location list window commands work', function()
|
|
||||||
call('XwindowTests', 'c')
|
|
||||||
expected_empty()
|
|
||||||
call('XwindowTests', 'l')
|
|
||||||
expected_empty()
|
|
||||||
end)
|
|
||||||
|
|
||||||
it('quickfix/location list file commands work', function()
|
|
||||||
call('XfileTests', 'c')
|
|
||||||
expected_empty()
|
|
||||||
call('XfileTests', 'l')
|
|
||||||
expected_empty()
|
|
||||||
end)
|
|
||||||
|
|
||||||
it('quickfix/location list buffer commands work', function()
|
|
||||||
call('XbufferTests', 'c')
|
|
||||||
expected_empty()
|
|
||||||
call('XbufferTests', 'l')
|
|
||||||
expected_empty()
|
|
||||||
end)
|
|
||||||
|
|
||||||
it('autocommands triggered by quickfix can get title', function()
|
|
||||||
execute('au FileType qf let g:foo = get(w:, "quickfix_title", "NONE")')
|
|
||||||
execute('call setqflist([])')
|
|
||||||
execute('copen')
|
|
||||||
eq(':setqflist()', eval('g:foo'))
|
|
||||||
end)
|
|
||||||
|
|
||||||
it('does not truncate quickfix title', function()
|
|
||||||
call('Test_vimgreptitle')
|
|
||||||
expected_empty()
|
|
||||||
end)
|
|
||||||
|
|
||||||
it('errors when an autocommand closes the location list\'s window', function()
|
|
||||||
call('Test_locationlist_curwin_was_closed')
|
|
||||||
expected_empty()
|
|
||||||
end)
|
|
||||||
|
|
||||||
it('checks locationlist protocol read', function()
|
|
||||||
call('Test_locationlist')
|
|
||||||
expected_empty()
|
|
||||||
end)
|
|
||||||
|
|
||||||
it('is changed by autocmd', function()
|
|
||||||
call('XquickfixChangedByAutocmd', 'c')
|
|
||||||
expected_empty()
|
|
||||||
call('XquickfixChangedByAutocmd', 'l')
|
|
||||||
expected_empty()
|
|
||||||
end)
|
|
||||||
|
|
||||||
it('does not crash after using caddbuffer with an empty qf list', function()
|
|
||||||
call('Test_caddbuffer_to_empty')
|
|
||||||
expected_empty()
|
|
||||||
end)
|
|
||||||
|
|
||||||
it('cgetexpr does not crash with a NULL element in a list', function()
|
|
||||||
execute('cgetexpr [$x]')
|
|
||||||
-- Still alive?
|
|
||||||
eq(2, eval('1+1'))
|
|
||||||
end)
|
|
||||||
end)
|
|
||||||
|
|
||||||
describe('errorformat', function()
|
|
||||||
before_each(function()
|
|
||||||
clear()
|
|
||||||
|
|
||||||
source([[
|
|
||||||
" More tests for 'errorformat'
|
|
||||||
function! Test_efm1()
|
|
||||||
if !has('unix')
|
|
||||||
" The 'errorformat' setting is different on non-Unix systems.
|
|
||||||
" This test works only on Unix-like systems.
|
|
||||||
return
|
|
||||||
endif
|
|
||||||
|
|
||||||
let l = [
|
|
||||||
\ '"Xtestfile", line 4.12: 1506-045 (S) Undeclared identifier fd_set.',
|
|
||||||
\ '"Xtestfile", line 6 col 19; this is an error',
|
|
||||||
\ 'gcc -c -DHAVE_CONFIsing-prototypes -I/usr/X11R6/include version.c',
|
|
||||||
\ 'Xtestfile:9: parse error before `asd''',
|
|
||||||
\ 'make: *** [vim] Error 1',
|
|
||||||
\ 'in file "Xtestfile" linenr 10: there is an error',
|
|
||||||
\ '',
|
|
||||||
\ '2 returned',
|
|
||||||
\ '"Xtestfile", line 11 col 1; this is an error',
|
|
||||||
\ '"Xtestfile", line 12 col 2; this is another error',
|
|
||||||
\ '"Xtestfile", line 14:10; this is an error in column 10',
|
|
||||||
\ '=Xtestfile=, line 15:10; this is another error, but in vcol 10 this time',
|
|
||||||
\ '"Xtestfile", linenr 16: yet another problem',
|
|
||||||
\ 'Error in "Xtestfile" at line 17:',
|
|
||||||
\ 'x should be a dot',
|
|
||||||
\ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 17',
|
|
||||||
\ ' ^',
|
|
||||||
\ 'Error in "Xtestfile" at line 18:',
|
|
||||||
\ 'x should be a dot',
|
|
||||||
\ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 18',
|
|
||||||
\ '.............^',
|
|
||||||
\ 'Error in "Xtestfile" at line 19:',
|
|
||||||
\ 'x should be a dot',
|
|
||||||
\ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 19',
|
|
||||||
\ '--------------^',
|
|
||||||
\ 'Error in "Xtestfile" at line 20:',
|
|
||||||
\ 'x should be a dot',
|
|
||||||
\ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 20',
|
|
||||||
\ ' ^',
|
|
||||||
\ '',
|
|
||||||
\ 'Does anyone know what is the problem and how to correction it?',
|
|
||||||
\ '"Xtestfile", line 21 col 9: What is the title of the quickfix window?',
|
|
||||||
\ '"Xtestfile", line 22 col 9: What is the title of the quickfix window?'
|
|
||||||
\ ]
|
|
||||||
|
|
||||||
call writefile(l, 'Xerrorfile1')
|
|
||||||
call writefile(l[:-2], 'Xerrorfile2')
|
|
||||||
|
|
||||||
let m = [
|
|
||||||
\ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 2',
|
|
||||||
\ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 3',
|
|
||||||
\ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 4',
|
|
||||||
\ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 5',
|
|
||||||
\ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 6',
|
|
||||||
\ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 7',
|
|
||||||
\ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 8',
|
|
||||||
\ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 9',
|
|
||||||
\ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 10',
|
|
||||||
\ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 11',
|
|
||||||
\ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 12',
|
|
||||||
\ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 13',
|
|
||||||
\ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 14',
|
|
||||||
\ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 15',
|
|
||||||
\ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 16',
|
|
||||||
\ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 17',
|
|
||||||
\ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 18',
|
|
||||||
\ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 19',
|
|
||||||
\ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 20',
|
|
||||||
\ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 21',
|
|
||||||
\ ' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx line 22'
|
|
||||||
\ ]
|
|
||||||
call writefile(m, 'Xtestfile')
|
|
||||||
|
|
||||||
let save_efm = &efm
|
|
||||||
set efm+==%f=\\,\ line\ %l%*\\D%v%*[^\ ]\ %m
|
|
||||||
set efm^=%AError\ in\ \"%f\"\ at\ line\ %l:,%Z%p^,%C%m
|
|
||||||
|
|
||||||
exe 'cf Xerrorfile2'
|
|
||||||
clast
|
|
||||||
copen
|
|
||||||
call assert_equal(':cf Xerrorfile2', w:quickfix_title)
|
|
||||||
wincmd p
|
|
||||||
|
|
||||||
exe 'cf Xerrorfile1'
|
|
||||||
call assert_equal([4, 12], [line('.'), col('.')])
|
|
||||||
cn
|
|
||||||
call assert_equal([6, 19], [line('.'), col('.')])
|
|
||||||
cn
|
|
||||||
call assert_equal([9, 2], [line('.'), col('.')])
|
|
||||||
cn
|
|
||||||
call assert_equal([10, 2], [line('.'), col('.')])
|
|
||||||
cn
|
|
||||||
call assert_equal([11, 1], [line('.'), col('.')])
|
|
||||||
cn
|
|
||||||
call assert_equal([12, 2], [line('.'), col('.')])
|
|
||||||
cn
|
|
||||||
call assert_equal([14, 10], [line('.'), col('.')])
|
|
||||||
cn
|
|
||||||
call assert_equal([15, 3, 10], [line('.'), col('.'), virtcol('.')])
|
|
||||||
cn
|
|
||||||
call assert_equal([16, 2], [line('.'), col('.')])
|
|
||||||
cn
|
|
||||||
call assert_equal([17, 6], [line('.'), col('.')])
|
|
||||||
cn
|
|
||||||
call assert_equal([18, 7], [line('.'), col('.')])
|
|
||||||
cn
|
|
||||||
call assert_equal([19, 8], [line('.'), col('.')])
|
|
||||||
cn
|
|
||||||
call assert_equal([20, 9], [line('.'), col('.')])
|
|
||||||
clast
|
|
||||||
cprev
|
|
||||||
cprev
|
|
||||||
wincmd w
|
|
||||||
call assert_equal(':cf Xerrorfile1', w:quickfix_title)
|
|
||||||
wincmd p
|
|
||||||
|
|
||||||
let &efm = save_efm
|
|
||||||
call delete('Xerrorfile1')
|
|
||||||
call delete('Xerrorfile2')
|
|
||||||
call delete('Xtestfile')
|
|
||||||
endfunction
|
|
||||||
]])
|
|
||||||
end)
|
|
||||||
|
|
||||||
it('works', function()
|
|
||||||
call('Test_efm1')
|
|
||||||
expected_empty()
|
|
||||||
end)
|
|
||||||
end)
|
|
||||||
@@ -18,9 +18,9 @@ describe('setqflist()', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('requires a string for {action}', function()
|
it('requires a string for {action}', function()
|
||||||
eq('Vim(call):E114: String required', exc_exec('call setqflist([], 5)'))
|
eq('Vim(call):E928: String required', exc_exec('call setqflist([], 5)'))
|
||||||
eq('Vim(call):E114: String required', exc_exec('call setqflist([], [])'))
|
eq('Vim(call):E928: String required', exc_exec('call setqflist([], [])'))
|
||||||
eq('Vim(call):E114: String required', exc_exec('call setqflist([], {})'))
|
eq('Vim(call):E928: String required', exc_exec('call setqflist([], {})'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('sets w:quickfix_title', function()
|
it('sets w:quickfix_title', function()
|
||||||
@@ -56,9 +56,9 @@ describe('setloclist()', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
it('requires a string for {action}', function()
|
it('requires a string for {action}', function()
|
||||||
eq('Vim(call):E114: String required', exc_exec('call setloclist(0, [], 5)'))
|
eq('Vim(call):E928: String required', exc_exec('call setloclist(0, [], 5)'))
|
||||||
eq('Vim(call):E114: String required', exc_exec('call setloclist(0, [], [])'))
|
eq('Vim(call):E928: String required', exc_exec('call setloclist(0, [], [])'))
|
||||||
eq('Vim(call):E114: String required', exc_exec('call setloclist(0, [], {})'))
|
eq('Vim(call):E928: String required', exc_exec('call setloclist(0, [], {})'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('sets w:quickfix_title for the correct window', function()
|
it('sets w:quickfix_title for the correct window', function()
|
||||||
|
|||||||
Reference in New Issue
Block a user