aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/path.c7
-rw-r--r--src/nvim/testdir/Makefile19
-rw-r--r--src/nvim/testdir/runtest.vim2
-rw-r--r--src/nvim/testdir/shared.vim8
-rw-r--r--src/nvim/testdir/test42.inbin2354 -> 2438 bytes
-rw-r--r--src/nvim/testdir/test52.in64
-rw-r--r--src/nvim/testdir/test52.ok18
-rw-r--r--src/nvim/testdir/test_increment_dbcs.vim4
-rw-r--r--src/nvim/testdir/test_mksession.vim5
-rw-r--r--src/nvim/testdir/test_undo.vim5
10 files changed, 37 insertions, 95 deletions
diff --git a/src/nvim/path.c b/src/nvim/path.c
index 75a26d88c1..a58d57d566 100644
--- a/src/nvim/path.c
+++ b/src/nvim/path.c
@@ -852,8 +852,13 @@ static char_u *get_path_cutoff(char_u *fname, garray_T *gap)
int j = 0;
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++;
+ }
if (j > maxlen) {
maxlen = j;
cutoff = &fname[j];
diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile
index 8b43d91e25..b72f55730f 100644
--- a/src/nvim/testdir/Makefile
+++ b/src/nvim/testdir/Makefile
@@ -16,7 +16,6 @@ export TMPDIR := $(abspath ../../../Xtest-tmpdir)
SCRIPTS_DEFAULT = \
test42.out \
test48.out \
- test52.out \
test64.out \
ifneq ($(OS),Windows_NT)
@@ -25,6 +24,12 @@ ifneq ($(OS),Windows_NT)
endif
+ifeq ($(OS),Windows_NT)
+ FIXFF = fixff
+else
+ FIXFF =
+endif
+
SCRIPTS ?= $(SCRIPTS_DEFAULT)
# Tests using runtest.vim.
@@ -74,7 +79,7 @@ ifdef TESTNUM
SCRIPTS := test$(TESTNUM).out
endif
-nongui: nolog $(SCRIPTS) newtests report
+nongui: nolog $(FIXFF) $(SCRIPTS) newtests report
.gdbinit:
@echo "[OLDTEST-PREP] Setting up .gdbinit"
@@ -95,6 +100,16 @@ test1.out: $(NVIM_PRG)
$(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_START := test.ok
RUN_VIM := $(TOOL) $(NVIM_PRG) -u unix.vim -U NONE -i viminfo --headless --noplugin -s dotest.in
diff --git a/src/nvim/testdir/runtest.vim b/src/nvim/testdir/runtest.vim
index 152fb93ca6..8b949d434e 100644
--- a/src/nvim/testdir/runtest.vim
+++ b/src/nvim/testdir/runtest.vim
@@ -79,7 +79,7 @@ set nomore
lang mess C
" Always use forward slashes.
-" set shellslash
+set shellslash
" Prepare for calling test_garbagecollect_now().
let v:testing = 1
diff --git a/src/nvim/testdir/shared.vim b/src/nvim/testdir/shared.vim
index ab0a4fd706..bcd6d021a0 100644
--- a/src/nvim/testdir/shared.vim
+++ b/src/nvim/testdir/shared.vim
@@ -202,9 +202,13 @@ endfunc
func GetVimProg()
if empty($NVIM_TEST_ARG0)
" 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
- return $NVIM_TEST_ARG0
endfunc
" Get the command to run Vim, with -u NONE and --headless arguments.
diff --git a/src/nvim/testdir/test42.in b/src/nvim/testdir/test42.in
index 0ea0198d12..baa6e67d26 100644
--- a/src/nvim/testdir/test42.in
+++ b/src/nvim/testdir/test42.in
Binary files differ
diff --git a/src/nvim/testdir/test52.in b/src/nvim/testdir/test52.in
deleted file mode 100644
index fa75129193..0000000000
--- a/src/nvim/testdir/test52.in
+++ /dev/null
@@ -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: Vim version 6.2. : 1970 Jan 01
-3 cp866 text: Vim version 6.2. ᫥ : 1970 Jan 01
diff --git a/src/nvim/testdir/test52.ok b/src/nvim/testdir/test52.ok
deleted file mode 100644
index 90b516508d..0000000000
--- a/src/nvim/testdir/test52.ok
+++ /dev/null
@@ -1,18 +0,0 @@
-1 utf-8 text: Для Vim version 6.2. Последнее изменение: 1970 Jan 01
-1 utf-8 text: Vim version 6.2. : 1970 Jan 01
-1 utf-8 text: Vim version 6.2. ᫥ : 1970 Jan 01
-2 cp1251 text: Для Vim version 6.2. Последнее изменение: 1970 Jan 01
-2 cp1251 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
-3 cp866 text: Vim version 6.2. : 1970 Jan 01
-3 cp866 text: Vim version 6.2. ᫥ : 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: 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: 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
diff --git a/src/nvim/testdir/test_increment_dbcs.vim b/src/nvim/testdir/test_increment_dbcs.vim
index 474a16feeb..e5d5ccffb3 100644
--- a/src/nvim/testdir/test_increment_dbcs.vim
+++ b/src/nvim/testdir/test_increment_dbcs.vim
@@ -1,5 +1,7 @@
" 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
endif
scriptencoding cp932
diff --git a/src/nvim/testdir/test_mksession.vim b/src/nvim/testdir/test_mksession.vim
index d77dac69c7..4e6d96ee48 100644
--- a/src/nvim/testdir/test_mksession.vim
+++ b/src/nvim/testdir/test_mksession.vim
@@ -206,11 +206,10 @@ func Test_mkview_loadview_with_viewdir()
" The directory Xviewdir/ should have been created and the view
" should be stored in that directory.
- let pathsep = has('win32') ? '\' : '/'
- call assert_equal('Xviewdir' . pathsep .
+ call assert_equal('Xviewdir/' .
\ substitute(
\ substitute(
- \ expand('%:p'), pathsep, '=+', 'g'), ':', '=-', 'g') . '=1.vim',
+ \ expand('%:p'), '/', '=+', 'g'), ':', '=-', 'g') . '=1.vim',
\ glob('Xviewdir/*'))
call assert_equal(1, &number)
call assert_match('\*:mkview\*$', getline('.'))
diff --git a/src/nvim/testdir/test_undo.vim b/src/nvim/testdir/test_undo.vim
index 0cb5dc4033..86674889ef 100644
--- a/src/nvim/testdir/test_undo.vim
+++ b/src/nvim/testdir/test_undo.vim
@@ -376,10 +376,9 @@ funct Test_undofile()
" Replace windows drive such as C:... into C%...
let cwd = substitute(cwd, '^\([a-zA-Z]\):', '\1%', 'g')
endif
- let pathsep = has('win32') ? '\' : '/'
- let cwd = substitute(cwd . pathsep . 'Xundofoo', pathsep, '%', 'g')
+ let cwd = substitute(cwd . '/Xundofoo', '/', '%', 'g')
if has('persistent_undo')
- call assert_equal('Xundodir' . pathsep . cwd, undofile('Xundofoo'))
+ call assert_equal('Xundodir/' . cwd, undofile('Xundofoo'))
else
call assert_equal('', undofile('Xundofoo'))
endif