mirror of
https://github.com/vim/vim.git
synced 2025-09-27 04:14:06 -04:00
patch 8.2.1305: some tests are still old style
Problem: Some tests are still old style. Solution: Convert tests 52 and 70 to new style. (Yegappan Lakshmanan, closes #6544) Fix error in FinishTesting().
This commit is contained in:
@@ -2310,10 +2310,7 @@ test_libvterm:
|
|||||||
|
|
||||||
# Run individual OLD style test.
|
# Run individual OLD style test.
|
||||||
# These do not depend on the executable, compile it when needed.
|
# These do not depend on the executable, compile it when needed.
|
||||||
test1 \
|
test1 test42 test49 test59:
|
||||||
test42 test49 \
|
|
||||||
test52 test59 \
|
|
||||||
test70:
|
|
||||||
cd testdir; rm -f $@.out; $(MAKE) -f Makefile $@.out VIMPROG=../$(VIMTESTTARGET) $(GUI_TESTARG) SCRIPTSOURCE=../$(SCRIPTSOURCE)
|
cd testdir; rm -f $@.out; $(MAKE) -f Makefile $@.out VIMPROG=../$(VIMTESTTARGET) $(GUI_TESTARG) SCRIPTSOURCE=../$(SCRIPTSOURCE)
|
||||||
|
|
||||||
# Run individual NEW style test.
|
# Run individual NEW style test.
|
||||||
|
@@ -8,25 +8,19 @@ NO_PLUGINS = --noplugin --not-a-term
|
|||||||
NO_INITS = -U NONE $(NO_PLUGINS)
|
NO_INITS = -U NONE $(NO_PLUGINS)
|
||||||
|
|
||||||
# The first script creates small.vim.
|
# The first script creates small.vim.
|
||||||
SCRIPTS_FIRST = \
|
SCRIPTS_FIRST = test1.out
|
||||||
test1.out
|
|
||||||
|
|
||||||
# Tests that run on all systems.
|
# Tests that run on all systems.
|
||||||
SCRIPTS_ALL = \
|
SCRIPTS_ALL = test42.out
|
||||||
test42.out \
|
|
||||||
test70.out
|
|
||||||
|
|
||||||
# Tests that run on most systems, but not on Amiga.
|
# Tests that run on most systems, but not on Amiga.
|
||||||
SCRIPTS_MORE1 = \
|
SCRIPTS_MORE1 =
|
||||||
test52.out
|
|
||||||
|
|
||||||
# Tests that run on most systems, but not on Amiga and DOS/Windows.
|
# Tests that run on most systems, but not on Amiga and DOS/Windows.
|
||||||
SCRIPTS_MORE2 = \
|
SCRIPTS_MORE2 = test49.out
|
||||||
test49.out
|
|
||||||
|
|
||||||
# Tests that run on most systems, but not on VMS
|
# Tests that run on most systems, but not on VMS
|
||||||
SCRIPTS_MORE4 = \
|
SCRIPTS_MORE4 = test59.out
|
||||||
test59.out
|
|
||||||
|
|
||||||
# Tests specifically for MS-Windows.
|
# Tests specifically for MS-Windows.
|
||||||
SCRIPTS_WIN32 =
|
SCRIPTS_WIN32 =
|
||||||
@@ -194,6 +188,7 @@ NEW_TESTS = \
|
|||||||
test_modeless \
|
test_modeless \
|
||||||
test_modeline \
|
test_modeline \
|
||||||
test_move \
|
test_move \
|
||||||
|
test_mzscheme \
|
||||||
test_nested_function \
|
test_nested_function \
|
||||||
test_netbeans \
|
test_netbeans \
|
||||||
test_normal \
|
test_normal \
|
||||||
@@ -426,6 +421,7 @@ NEW_TESTS_RES = \
|
|||||||
test_mksession.res \
|
test_mksession.res \
|
||||||
test_modeless.res \
|
test_modeless.res \
|
||||||
test_modeline.res \
|
test_modeline.res \
|
||||||
|
test_mzscheme.res \
|
||||||
test_nested_function.res \
|
test_nested_function.res \
|
||||||
test_netbeans.res \
|
test_netbeans.res \
|
||||||
test_normal.res \
|
test_normal.res \
|
||||||
|
@@ -9,12 +9,6 @@ default: nongui
|
|||||||
|
|
||||||
include Make_all.mak
|
include Make_all.mak
|
||||||
|
|
||||||
# These tests don't work (yet):
|
|
||||||
# test2 "\\tmp" doesn't work
|
|
||||||
# test10 'errorformat' is different
|
|
||||||
# test52 only for Win32
|
|
||||||
# test86, 87 no Python interface
|
|
||||||
|
|
||||||
SCRIPTS = $(SCRIPTS_ALL) $(SCRIPTS_MORE4)
|
SCRIPTS = $(SCRIPTS_ALL) $(SCRIPTS_MORE4)
|
||||||
|
|
||||||
# Must run test1 first to create small.vim.
|
# Must run test1 first to create small.vim.
|
||||||
|
@@ -81,40 +81,19 @@ SCRIPT = test1.out \
|
|||||||
# test59: Failed/Hangs - VMS does not support spell files (file names
|
# test59: Failed/Hangs - VMS does not support spell files (file names
|
||||||
# with too many dots).
|
# with too many dots).
|
||||||
#
|
#
|
||||||
# test78: bug - Vim dies at :recover Xtest
|
|
||||||
# test89: bug - findfile() does not work on VMS (just in the current directory)
|
|
||||||
# test102: Just ODS-5 supports space and special chars in the filename.
|
|
||||||
# On ODS-2 tests fail.
|
|
||||||
|
|
||||||
.IFDEF WANT_GUI
|
.IFDEF WANT_GUI
|
||||||
SCRIPT_GUI = test16.out
|
|
||||||
GUI_OPTION = -g
|
GUI_OPTION = -g
|
||||||
.ENDIF
|
.ENDIF
|
||||||
|
|
||||||
.IFDEF WANT_UNIX
|
.IFDEF WANT_UNIX
|
||||||
SCRIPT_UNIX = test10.out test27.out test49.out
|
SCRIPT_UNIX = test49.out
|
||||||
.ENDIF
|
|
||||||
|
|
||||||
.IFDEF WANT_WIN
|
|
||||||
SCRIPT_WIN = test52.out
|
|
||||||
.ENDIF
|
.ENDIF
|
||||||
|
|
||||||
.IFDEF WANT_SPELL
|
.IFDEF WANT_SPELL
|
||||||
SCRIPT_SPELL = test59.out
|
SCRIPT_SPELL = test59.out
|
||||||
.ENDIF
|
.ENDIF
|
||||||
|
|
||||||
.IFDEF WANT_MZSCH
|
|
||||||
SCRIPT_MZSCH = test70.out
|
|
||||||
.ENDIF
|
|
||||||
|
|
||||||
.IFDEF HAVE_ODS5
|
|
||||||
SCRIPT_ODS5 = test102.out
|
|
||||||
.ENDIF
|
|
||||||
|
|
||||||
.IFDEF HAVE_GDIFF
|
|
||||||
SCRIPT_GDIFF = test47.out
|
|
||||||
.ENDIF
|
|
||||||
|
|
||||||
.in.out :
|
.in.out :
|
||||||
-@ !clean up before doing the test
|
-@ !clean up before doing the test
|
||||||
-@ if "''F$SEARCH("test.out.*")'" .NES. "" then delete/noconfirm/nolog test.out.*
|
-@ if "''F$SEARCH("test.out.*")'" .NES. "" then delete/noconfirm/nolog test.out.*
|
||||||
@@ -135,8 +114,8 @@ SCRIPT_GDIFF = test47.out
|
|||||||
-@ if "''F$SEARCH("Xdotest.*")'" .NES. "" then delete/noconfirm/nolog Xdotest.*.*
|
-@ if "''F$SEARCH("Xdotest.*")'" .NES. "" then delete/noconfirm/nolog Xdotest.*.*
|
||||||
-@ if "''F$SEARCH("Xtest.*")'" .NES. "" then delete/noconfirm/nolog Xtest.*.*
|
-@ 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) \
|
all : clean nolog $(START_WITH) $(SCRIPT) $(SCRIPT_UNIX) $(SCRIPT_SPELL) \
|
||||||
$(SCRIPT_GDIFF) $(SCRIPT_MZSCH) $(SCRIPT_LUA) nolog
|
nolog
|
||||||
-@ write sys$output " "
|
-@ write sys$output " "
|
||||||
-@ write sys$output "-----------------------------------------------"
|
-@ write sys$output "-----------------------------------------------"
|
||||||
-@ write sys$output " All done"
|
-@ write sys$output " All done"
|
||||||
|
@@ -447,7 +447,7 @@ for g:testfunc in sort(s:tests)
|
|||||||
" - it fails again with the same message
|
" - it fails again with the same message
|
||||||
" - it fails five times (with a different message)
|
" - it fails five times (with a different message)
|
||||||
if len(v:errors) > 0
|
if len(v:errors) > 0
|
||||||
\ $TEST_NO_RETRY == ''
|
\ && $TEST_NO_RETRY == ''
|
||||||
\ && (index(s:flaky_tests, g:testfunc) >= 0
|
\ && (index(s:flaky_tests, g:testfunc) >= 0
|
||||||
\ || g:test_is_flaky)
|
\ || g:test_is_flaky)
|
||||||
while 1
|
while 1
|
||||||
|
@@ -1,65 +0,0 @@
|
|||||||
Tests for reading and writing files with conversion for Win32.
|
|
||||||
|
|
||||||
STARTTEST
|
|
||||||
:so mbyte.vim
|
|
||||||
:" 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
|
|
@@ -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
|
|
@@ -1,63 +0,0 @@
|
|||||||
Smoke test for MzScheme interface and mzeval() function
|
|
||||||
|
|
||||||
STARTTEST
|
|
||||||
:so mzscheme.vim
|
|
||||||
:set nocompatible viminfo+=nviminfo
|
|
||||||
:function! MzRequire()
|
|
||||||
:redir => l:mzversion
|
|
||||||
:mz (version)
|
|
||||||
:redir END
|
|
||||||
:if strpart(l:mzversion, 1, 1) < "4"
|
|
||||||
:" MzScheme versions < 4.x:
|
|
||||||
:mz (require (prefix vim- vimext))
|
|
||||||
:else
|
|
||||||
:" newer versions:
|
|
||||||
:mz (require (prefix-in vim- 'vimext))
|
|
||||||
:mz (require r5rs)
|
|
||||||
:endif
|
|
||||||
:endfunction
|
|
||||||
:silent call MzRequire()
|
|
||||||
:mz (define l '("item0" "dictionary with list OK" "item2"))
|
|
||||||
:mz (define h (make-hash))
|
|
||||||
:mz (hash-set! h "list" l)
|
|
||||||
/^1
|
|
||||||
:" change buffer contents
|
|
||||||
:mz (vim-set-buff-line (vim-eval "line('.')") "1 changed line 1")
|
|
||||||
:" scalar test
|
|
||||||
:let tmp_string = mzeval('"string"')
|
|
||||||
:let tmp_1000 = '1000'->mzeval()
|
|
||||||
:if tmp_string . tmp_1000 == "string1000"
|
|
||||||
:let scalar_res = "OK"
|
|
||||||
:else
|
|
||||||
:let scalar_res = "FAILED"
|
|
||||||
:endif
|
|
||||||
:call append(search("^1"), "scalar test " . scalar_res)
|
|
||||||
:" dictionary containing a list
|
|
||||||
:let tmp = mzeval("h")["list"][1]
|
|
||||||
:/^2/put =tmp
|
|
||||||
:" circular list (at the same time test lists containing lists)
|
|
||||||
:mz (set-car! (cddr l) l)
|
|
||||||
:let l2 = mzeval("h")["list"]
|
|
||||||
:if l2[2] == l2
|
|
||||||
:let res = "OK"
|
|
||||||
:else
|
|
||||||
:let res = "FAILED: " . l2[2]
|
|
||||||
:endif
|
|
||||||
:call setline(search("^3"), "circular test " . res)
|
|
||||||
:" funcrefs
|
|
||||||
:mz (define vim:max (vim-eval "function('max')"))
|
|
||||||
:mz (define m (vim:max '(1 100 8)))
|
|
||||||
:let m = mzeval('m')
|
|
||||||
:if m == 100
|
|
||||||
:let fref_res = "OK"
|
|
||||||
:else
|
|
||||||
:let fref_res = "FAILED: " . m
|
|
||||||
:end
|
|
||||||
:call append(line('$'), 'funcrefs '. fref_res)
|
|
||||||
:?^1?,$w! test.out
|
|
||||||
:qa!
|
|
||||||
ENDTEST
|
|
||||||
|
|
||||||
1 line 1
|
|
||||||
2 line 2
|
|
||||||
3 line 3
|
|
@@ -1,6 +0,0 @@
|
|||||||
1 changed line 1
|
|
||||||
scalar test OK
|
|
||||||
2 line 2
|
|
||||||
dictionary with list OK
|
|
||||||
circular test OK
|
|
||||||
funcrefs OK
|
|
62
src/testdir/test_mzscheme.vim
Normal file
62
src/testdir/test_mzscheme.vim
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
" Test for MzScheme interface and mzeval() function
|
||||||
|
|
||||||
|
source check.vim
|
||||||
|
CheckFeature mzscheme
|
||||||
|
|
||||||
|
func MzRequire()
|
||||||
|
redir => l:mzversion
|
||||||
|
mz (version)
|
||||||
|
redir END
|
||||||
|
if strpart(l:mzversion, 1, 1) < "4"
|
||||||
|
" MzScheme versions < 4.x:
|
||||||
|
mz (require (prefix vim- vimext))
|
||||||
|
else
|
||||||
|
" newer versions:
|
||||||
|
mz (require (prefix-in vim- 'vimext))
|
||||||
|
mz (require r5rs)
|
||||||
|
endif
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
func Test_mzscheme()
|
||||||
|
new
|
||||||
|
let lines =<< trim END
|
||||||
|
1 line 1
|
||||||
|
2 line 2
|
||||||
|
3 line 3
|
||||||
|
END
|
||||||
|
call setline(1, lines)
|
||||||
|
|
||||||
|
call MzRequire()
|
||||||
|
mz (define l '("item0" "dictionary with list OK" "item2"))
|
||||||
|
mz (define h (make-hash))
|
||||||
|
mz (hash-set! h "list" l)
|
||||||
|
|
||||||
|
call cursor(1, 1)
|
||||||
|
" change buffer contents
|
||||||
|
mz (vim-set-buff-line (vim-eval "line('.')") "1 changed line 1")
|
||||||
|
call assert_equal('1 changed line 1', getline(1))
|
||||||
|
|
||||||
|
" scalar test
|
||||||
|
let tmp_string = mzeval('"string"')
|
||||||
|
let tmp_1000 = '1000'->mzeval()
|
||||||
|
call assert_equal('string1000', tmp_string .. tmp_1000)
|
||||||
|
|
||||||
|
" dictionary containing a list
|
||||||
|
call assert_equal('dictionary with list OK', mzeval("h")["list"][1])
|
||||||
|
|
||||||
|
call cursor(2, 1)
|
||||||
|
" circular list (at the same time test lists containing lists)
|
||||||
|
mz (set-car! (cddr l) l)
|
||||||
|
let l2 = mzeval("h")["list"]
|
||||||
|
call assert_equal(l2[2], l2)
|
||||||
|
|
||||||
|
" funcrefs
|
||||||
|
mz (define vim:max (vim-eval "function('max')"))
|
||||||
|
mz (define m (vim:max '(1 100 8)))
|
||||||
|
let m = mzeval('m')
|
||||||
|
call assert_equal(100, m)
|
||||||
|
|
||||||
|
close!
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
" vim: shiftwidth=2 sts=2 expandtab
|
@@ -442,4 +442,118 @@ func Test_write_invalid_encoding()
|
|||||||
close!
|
close!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
" Tests for reading and writing files with conversion for Win32.
|
||||||
|
func Test_write_file_encoding()
|
||||||
|
CheckMSWindows
|
||||||
|
let save_encoding = &encoding
|
||||||
|
let save_fileencodings = &fileencodings
|
||||||
|
set encoding& fileencodings&
|
||||||
|
let text =<< trim END
|
||||||
|
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
|
||||||
|
END
|
||||||
|
call writefile(text, 'Xfile')
|
||||||
|
edit Xfile
|
||||||
|
|
||||||
|
" write tests:
|
||||||
|
" combine three values for 'encoding' with three values for 'fileencoding'
|
||||||
|
" also write files for read tests
|
||||||
|
call cursor(1, 1)
|
||||||
|
set encoding=utf-8
|
||||||
|
.w! ++enc=utf-8 Xtest
|
||||||
|
.w ++enc=cp1251 >> Xtest
|
||||||
|
.w ++enc=cp866 >> Xtest
|
||||||
|
.w! ++enc=utf-8 Xutf8
|
||||||
|
let expected =<< trim END
|
||||||
|
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
|
||||||
|
END
|
||||||
|
call assert_equal(expected, readfile('Xtest'))
|
||||||
|
|
||||||
|
call cursor(2, 1)
|
||||||
|
set encoding=cp1251
|
||||||
|
.w! ++enc=utf-8 Xtest
|
||||||
|
.w ++enc=cp1251 >> Xtest
|
||||||
|
.w ++enc=cp866 >> Xtest
|
||||||
|
.w! ++enc=cp1251 Xcp1251
|
||||||
|
let expected =<< trim END
|
||||||
|
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
|
||||||
|
END
|
||||||
|
call assert_equal(expected, readfile('Xtest'))
|
||||||
|
|
||||||
|
call cursor(3, 1)
|
||||||
|
set encoding=cp866
|
||||||
|
.w! ++enc=utf-8 Xtest
|
||||||
|
.w ++enc=cp1251 >> Xtest
|
||||||
|
.w ++enc=cp866 >> Xtest
|
||||||
|
.w! ++enc=cp866 Xcp866
|
||||||
|
let expected =<< trim END
|
||||||
|
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
|
||||||
|
END
|
||||||
|
call assert_equal(expected, readfile('Xtest'))
|
||||||
|
|
||||||
|
" read three 'fileencoding's with utf-8 'encoding'
|
||||||
|
set encoding=utf-8 fencs=utf-8,cp1251
|
||||||
|
e Xutf8
|
||||||
|
.w! ++enc=utf-8 Xtest
|
||||||
|
e Xcp1251
|
||||||
|
.w ++enc=utf-8 >> Xtest
|
||||||
|
set fencs=utf-8,cp866
|
||||||
|
e Xcp866
|
||||||
|
.w ++enc=utf-8 >> Xtest
|
||||||
|
let expected =<< trim END
|
||||||
|
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
|
||||||
|
END
|
||||||
|
call assert_equal(expected, readfile('Xtest'))
|
||||||
|
|
||||||
|
" read three 'fileencoding's with cp1251 'encoding'
|
||||||
|
set encoding=utf-8 fencs=utf-8,cp1251
|
||||||
|
e Xutf8
|
||||||
|
.w! ++enc=cp1251 Xtest
|
||||||
|
e Xcp1251
|
||||||
|
.w ++enc=cp1251 >> Xtest
|
||||||
|
set fencs=utf-8,cp866
|
||||||
|
e Xcp866
|
||||||
|
.w ++enc=cp1251 >> Xtest
|
||||||
|
let expected =<< trim END
|
||||||
|
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
|
||||||
|
END
|
||||||
|
call assert_equal(expected, readfile('Xtest'))
|
||||||
|
|
||||||
|
" read three 'fileencoding's with cp866 'encoding'
|
||||||
|
set encoding=cp866 fencs=utf-8,cp1251
|
||||||
|
e Xutf8
|
||||||
|
.w! ++enc=cp866 Xtest
|
||||||
|
e Xcp1251
|
||||||
|
.w ++enc=cp866 >> Xtest
|
||||||
|
set fencs=utf-8,cp866
|
||||||
|
e Xcp866
|
||||||
|
.w ++enc=cp866 >> Xtest
|
||||||
|
let expected =<< trim END
|
||||||
|
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
|
||||||
|
END
|
||||||
|
call assert_equal(expected, readfile('Xtest'))
|
||||||
|
|
||||||
|
call delete('Xfile')
|
||||||
|
call delete('Xtest')
|
||||||
|
call delete('Xutf8')
|
||||||
|
call delete('Xcp1251')
|
||||||
|
call delete('Xcp866')
|
||||||
|
let &encoding = save_encoding
|
||||||
|
let &fileencodings = save_fileencodings
|
||||||
|
%bw!
|
||||||
|
endfunc
|
||||||
|
|
||||||
" vim: shiftwidth=2 sts=2 expandtab
|
" vim: shiftwidth=2 sts=2 expandtab
|
||||||
|
@@ -754,6 +754,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1305,
|
||||||
/**/
|
/**/
|
||||||
1304,
|
1304,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user