Merge #10679 from erw7/fix-oldtest-on-windows

This commit is contained in:
Justin M. Keyes
2019-08-18 13:31:28 +02:00
committed by GitHub
10 changed files with 37 additions and 95 deletions

View File

@@ -852,8 +852,13 @@ static char_u *get_path_cutoff(char_u *fname, garray_T *gap)
int j = 0; int j = 0;
while ((fname[j] == path_part[i][j] while ((fname[j] == path_part[i][j]
) && fname[j] != NUL && path_part[i][j] != NUL) #ifdef WIN32
|| (vim_ispathsep(fname[j]) && vim_ispathsep(path_part[i][j]))
#endif
) // NOLINT(whitespace/parens)
&& fname[j] != NUL && path_part[i][j] != NUL) {
j++; j++;
}
if (j > maxlen) { if (j > maxlen) {
maxlen = j; maxlen = j;
cutoff = &fname[j]; cutoff = &fname[j];

View File

@@ -16,7 +16,6 @@ export TMPDIR := $(abspath ../../../Xtest-tmpdir)
SCRIPTS_DEFAULT = \ SCRIPTS_DEFAULT = \
test42.out \ test42.out \
test48.out \ test48.out \
test52.out \
test64.out \ test64.out \
ifneq ($(OS),Windows_NT) ifneq ($(OS),Windows_NT)
@@ -25,6 +24,12 @@ ifneq ($(OS),Windows_NT)
endif endif
ifeq ($(OS),Windows_NT)
FIXFF = fixff
else
FIXFF =
endif
SCRIPTS ?= $(SCRIPTS_DEFAULT) SCRIPTS ?= $(SCRIPTS_DEFAULT)
# Tests using runtest.vim. # Tests using runtest.vim.
@@ -74,7 +79,7 @@ ifdef TESTNUM
SCRIPTS := test$(TESTNUM).out SCRIPTS := test$(TESTNUM).out
endif endif
nongui: nolog $(SCRIPTS) newtests report nongui: nolog $(FIXFF) $(SCRIPTS) newtests report
.gdbinit: .gdbinit:
@echo "[OLDTEST-PREP] Setting up .gdbinit" @echo "[OLDTEST-PREP] Setting up .gdbinit"
@@ -95,6 +100,16 @@ test1.out: $(NVIM_PRG)
$(SCRIPTS): $(NVIM_PRG) test1.out $(SCRIPTS): $(NVIM_PRG) test1.out
NO_PLUGINS = --noplugin --headless
NO_INITS = -U NONE $(NO_PLUGINS)
# TODO: find a way to avoid changing the distributed files.
fixff:
-$(NVIM_PRG) -u unix.vim $(NO_INITS) "+argdo set ff=dos|upd" +q \
*.in *.ok
-$(NVIM_PRG) -u unix.vim $(NO_INITS) "+argdo set ff=dos|upd" +q \
dotest.in
RM_ON_RUN := test.out X* viminfo RM_ON_RUN := test.out X* viminfo
RM_ON_START := test.ok RM_ON_START := test.ok
RUN_VIM := $(TOOL) $(NVIM_PRG) -u unix.vim -U NONE -i viminfo --headless --noplugin -s dotest.in RUN_VIM := $(TOOL) $(NVIM_PRG) -u unix.vim -U NONE -i viminfo --headless --noplugin -s dotest.in

View File

@@ -79,7 +79,7 @@ set nomore
lang mess C lang mess C
" Always use forward slashes. " Always use forward slashes.
" set shellslash set shellslash
" Prepare for calling test_garbagecollect_now(). " Prepare for calling test_garbagecollect_now().
let v:testing = 1 let v:testing = 1

View File

@@ -202,9 +202,13 @@ endfunc
func GetVimProg() func GetVimProg()
if empty($NVIM_TEST_ARG0) if empty($NVIM_TEST_ARG0)
" Assume the script was sourced instead of running "make". " Assume the script was sourced instead of running "make".
return '../../../build/bin/nvim' return v:progpath
endif
if has('win32')
return substitute($NVIM_TEST_ARG0, '/', '\\', 'g')
else
return $NVIM_TEST_ARG0
endif endif
return $NVIM_TEST_ARG0
endfunc endfunc
" Get the command to run Vim, with -u NONE and --headless arguments. " Get the command to run Vim, with -u NONE and --headless arguments.

Binary file not shown.

View File

@@ -1,64 +0,0 @@
Tests for reading and writing files with conversion for Win32.
STARTTEST
:" make this a dummy test for non-Win32 systems
:if !has("win32") | e! test.ok | wq! test.out | endif
:"
:" write tests:
:" combine three values for 'encoding' with three values for 'fileencoding'
:" also write files for read tests
/^1
:set encoding=utf-8
:.w! ++enc=utf-8 test.out
:.w ++enc=cp1251 >>test.out
:.w ++enc=cp866 >>test.out
:.w! ++enc=utf-8 Xutf8
/^2
:set encoding=cp1251
:.w ++enc=utf-8 >>test.out
:.w ++enc=cp1251 >>test.out
:.w ++enc=cp866 >>test.out
:.w! ++enc=cp1251 Xcp1251
/^3
:set encoding=cp866
:.w ++enc=utf-8 >>test.out
:.w ++enc=cp1251 >>test.out
:.w ++enc=cp866 >>test.out
:.w! ++enc=cp866 Xcp866
:"
:" read three 'fileencoding's with utf-8 'encoding'
:set encoding=utf-8 fencs=utf-8,cp1251
:e Xutf8
:.w ++enc=utf-8 >>test.out
:e Xcp1251
:.w ++enc=utf-8 >>test.out
:set fencs=utf-8,cp866
:e Xcp866
:.w ++enc=utf-8 >>test.out
:"
:" read three 'fileencoding's with cp1251 'encoding'
:set encoding=utf-8 fencs=utf-8,cp1251
:e Xutf8
:.w ++enc=cp1251 >>test.out
:e Xcp1251
:.w ++enc=cp1251 >>test.out
:set fencs=utf-8,cp866
:e Xcp866
:.w ++enc=cp1251 >>test.out
:"
:" read three 'fileencoding's with cp866 'encoding'
:set encoding=cp866 fencs=utf-8,cp1251
:e Xutf8
:.w ++enc=cp866 >>test.out
:e Xcp1251
:.w ++enc=cp866 >>test.out
:set fencs=utf-8,cp866
:e Xcp866
:.w ++enc=cp866 >>test.out
:"
:qa!
ENDTEST
1 utf-8 text: Для Vim version 6.2. Последнее изменение: 1970 Jan 01
2 cp1251 text: <20><><EFBFBD> Vim version 6.2. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: 1970 Jan 01
3 cp866 text: <20><><EFBFBD> Vim version 6.2. <20><><EFBFBD><E1ABA5><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: 1970 Jan 01

View File

@@ -1,18 +0,0 @@
1 utf-8 text: Для Vim version 6.2. Последнее изменение: 1970 Jan 01
1 utf-8 text: <20><><EFBFBD> Vim version 6.2. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: 1970 Jan 01
1 utf-8 text: <20><><EFBFBD> Vim version 6.2. <20><><EFBFBD><E1ABA5><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: 1970 Jan 01
2 cp1251 text: Для Vim version 6.2. Последнее изменение: 1970 Jan 01
2 cp1251 text: <20><><EFBFBD> Vim version 6.2. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: 1970 Jan 01
2 cp1251 text: <20><><EFBFBD> Vim version 6.2. <20><><EFBFBD><E1ABA5><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: 1970 Jan 01
3 cp866 text: Для Vim version 6.2. Последнее изменение: 1970 Jan 01
3 cp866 text: <20><><EFBFBD> Vim version 6.2. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: 1970 Jan 01
3 cp866 text: <20><><EFBFBD> Vim version 6.2. <20><><EFBFBD><E1ABA5><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: 1970 Jan 01
1 utf-8 text: Для Vim version 6.2. Последнее изменение: 1970 Jan 01
2 cp1251 text: Для Vim version 6.2. Последнее изменение: 1970 Jan 01
3 cp866 text: Для Vim version 6.2. Последнее изменение: 1970 Jan 01
1 utf-8 text: <20><><EFBFBD> Vim version 6.2. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: 1970 Jan 01
2 cp1251 text: <20><><EFBFBD> Vim version 6.2. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: 1970 Jan 01
3 cp866 text: <20><><EFBFBD> Vim version 6.2. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: 1970 Jan 01
1 utf-8 text: <20><><EFBFBD> Vim version 6.2. <20><><EFBFBD><E1ABA5><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: 1970 Jan 01
2 cp1251 text: <20><><EFBFBD> Vim version 6.2. <20><><EFBFBD><E1ABA5><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: 1970 Jan 01
3 cp866 text: <20><><EFBFBD> Vim version 6.2. <20><><EFBFBD><E1ABA5><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: 1970 Jan 01

View File

@@ -1,5 +1,7 @@
" Tests for using Ctrl-A/Ctrl-X using DBCS. " Tests for using Ctrl-A/Ctrl-X using DBCS.
if !has('multi_byte') " neovim needs an iconv to handle cp932. Please do not remove the following
" conditions.
if !has('iconv')
finish finish
endif endif
scriptencoding cp932 scriptencoding cp932

View File

@@ -206,11 +206,10 @@ func Test_mkview_loadview_with_viewdir()
" The directory Xviewdir/ should have been created and the view " The directory Xviewdir/ should have been created and the view
" should be stored in that directory. " should be stored in that directory.
let pathsep = has('win32') ? '\' : '/' call assert_equal('Xviewdir/' .
call assert_equal('Xviewdir' . pathsep .
\ substitute( \ substitute(
\ substitute( \ substitute(
\ expand('%:p'), pathsep, '=+', 'g'), ':', '=-', 'g') . '=1.vim', \ expand('%:p'), '/', '=+', 'g'), ':', '=-', 'g') . '=1.vim',
\ glob('Xviewdir/*')) \ glob('Xviewdir/*'))
call assert_equal(1, &number) call assert_equal(1, &number)
call assert_match('\*:mkview\*$', getline('.')) call assert_match('\*:mkview\*$', getline('.'))

View File

@@ -376,10 +376,9 @@ funct Test_undofile()
" Replace windows drive such as C:... into C%... " Replace windows drive such as C:... into C%...
let cwd = substitute(cwd, '^\([a-zA-Z]\):', '\1%', 'g') let cwd = substitute(cwd, '^\([a-zA-Z]\):', '\1%', 'g')
endif endif
let pathsep = has('win32') ? '\' : '/' let cwd = substitute(cwd . '/Xundofoo', '/', '%', 'g')
let cwd = substitute(cwd . pathsep . 'Xundofoo', pathsep, '%', 'g')
if has('persistent_undo') if has('persistent_undo')
call assert_equal('Xundodir' . pathsep . cwd, undofile('Xundofoo')) call assert_equal('Xundodir/' . cwd, undofile('Xundofoo'))
else else
call assert_equal('', undofile('Xundofoo')) call assert_equal('', undofile('Xundofoo'))
endif endif