summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-07-27 20:02:41 +0200
committerBram Moolenaar <Bram@vim.org>2020-07-27 20:02:41 +0200
commit622b3568fa1baf07671d31390815fb0a55a99891 (patch)
treebf3b4666404b49c91e95ee2e938e99ecc8a6d3ca
parent6ca6ca48898750dd55cad13c88a9c1dfd7fdaad5 (diff)
downloadvim-git-622b3568fa1baf07671d31390815fb0a55a99891.tar.gz
patch 8.2.1305: some tests are still old stylev8.2.1305
Problem: Some tests are still old style. Solution: Convert tests 52 and 70 to new style. (Yegappan Lakshmanan, closes #6544) Fix error in FinishTesting().
-rw-r--r--src/Makefile5
-rw-r--r--src/testdir/Make_all.mak18
-rw-r--r--src/testdir/Make_amiga.mak6
-rw-r--r--src/testdir/Make_vms.mms27
-rw-r--r--src/testdir/runtest.vim2
-rw-r--r--src/testdir/test52.in65
-rw-r--r--src/testdir/test52.ok18
-rw-r--r--src/testdir/test70.in63
-rw-r--r--src/testdir/test70.ok6
-rw-r--r--src/testdir/test_mzscheme.vim62
-rw-r--r--src/testdir/test_writefile.vim114
-rw-r--r--src/version.c2
12 files changed, 190 insertions, 198 deletions
diff --git a/src/Makefile b/src/Makefile
index 9ce61aa01..bbf80d326 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -2310,10 +2310,7 @@ test_libvterm:
# Run individual OLD style test.
# These do not depend on the executable, compile it when needed.
-test1 \
- test42 test49 \
- test52 test59 \
- test70:
+test1 test42 test49 test59:
cd testdir; rm -f $@.out; $(MAKE) -f Makefile $@.out VIMPROG=../$(VIMTESTTARGET) $(GUI_TESTARG) SCRIPTSOURCE=../$(SCRIPTSOURCE)
# Run individual NEW style test.
diff --git a/src/testdir/Make_all.mak b/src/testdir/Make_all.mak
index b2d9ac6f0..a25a480dd 100644
--- a/src/testdir/Make_all.mak
+++ b/src/testdir/Make_all.mak
@@ -8,25 +8,19 @@ NO_PLUGINS = --noplugin --not-a-term
NO_INITS = -U NONE $(NO_PLUGINS)
# The first script creates small.vim.
-SCRIPTS_FIRST = \
- test1.out
+SCRIPTS_FIRST = test1.out
# Tests that run on all systems.
-SCRIPTS_ALL = \
- test42.out \
- test70.out
+SCRIPTS_ALL = test42.out
# Tests that run on most systems, but not on Amiga.
-SCRIPTS_MORE1 = \
- test52.out
+SCRIPTS_MORE1 =
# Tests that run on most systems, but not on Amiga and DOS/Windows.
-SCRIPTS_MORE2 = \
- test49.out
+SCRIPTS_MORE2 = test49.out
# Tests that run on most systems, but not on VMS
-SCRIPTS_MORE4 = \
- test59.out
+SCRIPTS_MORE4 = test59.out
# Tests specifically for MS-Windows.
SCRIPTS_WIN32 =
@@ -194,6 +188,7 @@ NEW_TESTS = \
test_modeless \
test_modeline \
test_move \
+ test_mzscheme \
test_nested_function \
test_netbeans \
test_normal \
@@ -426,6 +421,7 @@ NEW_TESTS_RES = \
test_mksession.res \
test_modeless.res \
test_modeline.res \
+ test_mzscheme.res \
test_nested_function.res \
test_netbeans.res \
test_normal.res \
diff --git a/src/testdir/Make_amiga.mak b/src/testdir/Make_amiga.mak
index df77e4dc4..e6e55e3b4 100644
--- a/src/testdir/Make_amiga.mak
+++ b/src/testdir/Make_amiga.mak
@@ -9,12 +9,6 @@ default: nongui
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)
# Must run test1 first to create small.vim.
diff --git a/src/testdir/Make_vms.mms b/src/testdir/Make_vms.mms
index 352e5539e..af76f703a 100644
--- a/src/testdir/Make_vms.mms
+++ b/src/testdir/Make_vms.mms
@@ -81,40 +81,19 @@ SCRIPT = test1.out \
# test59: Failed/Hangs - VMS does not support spell files (file names
# 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
-SCRIPT_GUI = test16.out
GUI_OPTION = -g
.ENDIF
.IFDEF WANT_UNIX
-SCRIPT_UNIX = test10.out test27.out test49.out
-.ENDIF
-
-.IFDEF WANT_WIN
-SCRIPT_WIN = test52.out
+SCRIPT_UNIX = test49.out
.ENDIF
.IFDEF WANT_SPELL
SCRIPT_SPELL = test59.out
.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 :
-@ !clean up before doing the test
-@ 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("Xtest.*")'" .NES. "" then delete/noconfirm/nolog Xtest.*.*
-all : clean nolog $(START_WITH) $(SCRIPT) $(SCRIPT_GUI) $(SCRIPT_UNIX) $(SCRIPT_WIN) $(SCRIPT_SPELL) $(SCRIPT_ODS5) \
- $(SCRIPT_GDIFF) $(SCRIPT_MZSCH) $(SCRIPT_LUA) nolog
+all : clean nolog $(START_WITH) $(SCRIPT) $(SCRIPT_UNIX) $(SCRIPT_SPELL) \
+ nolog
-@ write sys$output " "
-@ write sys$output "-----------------------------------------------"
-@ write sys$output " All done"
diff --git a/src/testdir/runtest.vim b/src/testdir/runtest.vim
index 6cc7202dc..e42b0cabd 100644
--- a/src/testdir/runtest.vim
+++ b/src/testdir/runtest.vim
@@ -447,7 +447,7 @@ for g:testfunc in sort(s:tests)
" - it fails again with the same message
" - it fails five times (with a different message)
if len(v:errors) > 0
- \ $TEST_NO_RETRY == ''
+ \ && $TEST_NO_RETRY == ''
\ && (index(s:flaky_tests, g:testfunc) >= 0
\ || g:test_is_flaky)
while 1
diff --git a/src/testdir/test52.in b/src/testdir/test52.in
deleted file mode 100644
index 206b65a1f..000000000
--- a/src/testdir/test52.in
+++ /dev/null
@@ -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: Vim version 6.2. : 1970 Jan 01
-3 cp866 text: Vim version 6.2. ᫥ : 1970 Jan 01
diff --git a/src/testdir/test52.ok b/src/testdir/test52.ok
deleted file mode 100644
index 90b516508..000000000
--- a/src/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/testdir/test70.in b/src/testdir/test70.in
deleted file mode 100644
index 9ee59c3a2..000000000
--- a/src/testdir/test70.in
+++ /dev/null
@@ -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
diff --git a/src/testdir/test70.ok b/src/testdir/test70.ok
deleted file mode 100644
index 9c82a86f2..000000000
--- a/src/testdir/test70.ok
+++ /dev/null
@@ -1,6 +0,0 @@
-1 changed line 1
-scalar test OK
-2 line 2
-dictionary with list OK
-circular test OK
-funcrefs OK
diff --git a/src/testdir/test_mzscheme.vim b/src/testdir/test_mzscheme.vim
new file mode 100644
index 000000000..0bc98421d
--- /dev/null
+++ b/src/testdir/test_mzscheme.vim
@@ -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
diff --git a/src/testdir/test_writefile.vim b/src/testdir/test_writefile.vim
index 5c9e4b12b..d92d6aedb 100644
--- a/src/testdir/test_writefile.vim
+++ b/src/testdir/test_writefile.vim
@@ -442,4 +442,118 @@ func Test_write_invalid_encoding()
close!
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: Vim version 6.2. : 1970 Jan 01
+ 3 cp866 text: Vim version 6.2. ᫥ : 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: Vim version 6.2. : 1970 Jan 01
+ 1 utf-8 text: Vim version 6.2. ᫥ : 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: Vim version 6.2. : 1970 Jan 01
+ 2 cp1251 text: Vim version 6.2. ᫥ : 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: 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 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: 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 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: 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'))
+
+ 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
diff --git a/src/version.c b/src/version.c
index c41d93218..ec702330b 100644
--- a/src/version.c
+++ b/src/version.c
@@ -755,6 +755,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1305,
+/**/
1304,
/**/
1303,