Skip to content

Commit c6b37db

Browse files
committed
patch 8.1.1214: old style tests
Problem: Old style tests. Solution: Move tests from test14 to new style test files. (Yegappan Lakshmanan, closes #4308)
1 parent e13a390 commit c6b37db

11 files changed

Lines changed: 206 additions & 131 deletions

src/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2175,7 +2175,7 @@ test_libvterm:
21752175
# These do not depend on the executable, compile it when needed.
21762176
test1 \
21772177
test_eval \
2178-
test3 test14 test17 \
2178+
test3 test17 \
21792179
test29 test30 test37 test39 \
21802180
test42 test44 test48 test49 \
21812181
test52 test59 \

src/testdir/Make_all.mak

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ SCRIPTS_FIRST = \
1414
# Tests that run on all systems.
1515
SCRIPTS_ALL = \
1616
test3.out \
17-
test14.out \
1817
test29.out \
1918
test37.out \
2019
test39.out \

src/testdir/Make_vms.mms

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ VIMPROG = <->vim.exe
7474
.SUFFIXES : .out .in
7575

7676
SCRIPT = test1.out test3.out \
77-
test14.out \
7877
test29.out \
7978
test30.out test37.out test39.out \
8079
test42.out test44.out test48.out test49.out \

src/testdir/test14.in

Lines changed: 0 additions & 100 deletions
This file was deleted.

src/testdir/test14.ok

Lines changed: 0 additions & 26 deletions
This file was deleted.

src/testdir/test_edit.vim

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1447,3 +1447,19 @@ func Test_leave_insert_autocmd()
14471447
au! InsertLeave
14481448
iunmap x
14491449
endfunc
1450+
1451+
" Test for inserting characters using CTRL-V followed by a number.
1452+
func Test_edit_special_chars()
1453+
new
1454+
1455+
if has("ebcdic")
1456+
let t = "o\<C-V>193\<C-V>xc2\<C-V>o303 \<C-V>90a\<C-V>xfg\<C-V>o578\<Esc>"
1457+
else
1458+
let t = "o\<C-V>65\<C-V>x42\<C-V>o103 \<C-V>33a\<C-V>xfg\<C-V>o78\<Esc>"
1459+
endif
1460+
1461+
exe "normal " . t
1462+
call assert_equal("ABC !a\<C-O>g\<C-G>8", getline(2))
1463+
1464+
close!
1465+
endfunc

src/testdir/test_normal.vim

Lines changed: 90 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1358,11 +1358,21 @@ func Test_normal23_K()
13581358
bw!
13591359
return
13601360
endif
1361-
set keywordprg=man\ --pager=cat
1361+
1362+
if has('mac')
1363+
" In MacOS, the option for specifying a pager is different
1364+
set keywordprg=man\ -P\ cat
1365+
else
1366+
set keywordprg=man\ --pager=cat
1367+
endif
13621368
" Test for using man
13631369
2
13641370
let a = execute('unsilent norm! K')
1365-
call assert_match("man --pager=cat 'man'", a)
1371+
if has('mac')
1372+
call assert_match("man -P cat 'man'", a)
1373+
else
1374+
call assert_match("man --pager=cat 'man'", a)
1375+
endif
13661376

13671377
" clean up
13681378
let &keywordprg = k
@@ -2559,3 +2569,81 @@ func Test_message_when_using_ctrl_c()
25592569

25602570
bwipe!
25612571
endfunc
2572+
2573+
" Test for '[m', ']m', '[M' and ']M'
2574+
" Jumping to beginning and end of methods in Java-like languages
2575+
func Test_java_motion()
2576+
new
2577+
a
2578+
Piece of Java
2579+
{
2580+
tt m1 {
2581+
t1;
2582+
} e1
2583+
2584+
tt m2 {
2585+
t2;
2586+
} e2
2587+
2588+
tt m3 {
2589+
if (x)
2590+
{
2591+
t3;
2592+
}
2593+
} e3
2594+
}
2595+
.
2596+
2597+
normal gg
2598+
2599+
normal 2]maA
2600+
call assert_equal("\ttt m1 {A", getline('.'))
2601+
call assert_equal([3, 9, 16], [line('.'), col('.'), virtcol('.')])
2602+
2603+
normal j]maB
2604+
call assert_equal("\ttt m2 {B", getline('.'))
2605+
call assert_equal([7, 9, 16], [line('.'), col('.'), virtcol('.')])
2606+
2607+
normal ]maC
2608+
call assert_equal("\ttt m3 {C", getline('.'))
2609+
call assert_equal([11, 9, 16], [line('.'), col('.'), virtcol('.')])
2610+
2611+
normal [maD
2612+
call assert_equal("\ttt m3 {DC", getline('.'))
2613+
call assert_equal([11, 9, 16], [line('.'), col('.'), virtcol('.')])
2614+
2615+
normal k2[maE
2616+
call assert_equal("\ttt m1 {EA", getline('.'))
2617+
call assert_equal([3, 9, 16], [line('.'), col('.'), virtcol('.')])
2618+
2619+
normal 3[maF
2620+
call assert_equal("{F", getline('.'))
2621+
call assert_equal([2, 2, 2], [line('.'), col('.'), virtcol('.')])
2622+
2623+
normal ]MaG
2624+
call assert_equal("\t}G e1", getline('.'))
2625+
call assert_equal([5, 3, 10], [line('.'), col('.'), virtcol('.')])
2626+
2627+
normal j2]MaH
2628+
call assert_equal("\t}H e3", getline('.'))
2629+
call assert_equal([16, 3, 10], [line('.'), col('.'), virtcol('.')])
2630+
2631+
normal ]M]M
2632+
normal aI
2633+
call assert_equal("}I", getline('.'))
2634+
call assert_equal([17, 2, 2], [line('.'), col('.'), virtcol('.')])
2635+
2636+
normal 2[MaJ
2637+
call assert_equal("\t}JH e3", getline('.'))
2638+
call assert_equal([16, 3, 10], [line('.'), col('.'), virtcol('.')])
2639+
2640+
normal k[MaK
2641+
call assert_equal("\t}K e2", getline('.'))
2642+
call assert_equal([9, 3, 10], [line('.'), col('.'), virtcol('.')])
2643+
2644+
normal 3[MaL
2645+
call assert_equal("{LF", getline('.'))
2646+
call assert_equal([2, 2, 2], [line('.'), col('.'), virtcol('.')])
2647+
2648+
close!
2649+
endfunc

src/testdir/test_search.vim

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1265,3 +1265,27 @@ func Test_incsearch_add_char_under_cursor()
12651265
set incsearch&
12661266
bwipe!
12671267
endfunc
1268+
1269+
" Test for the search() function with match at the cursor position
1270+
func Test_search_match_at_curpos()
1271+
new
1272+
call append(0, ['foobar', '', 'one two', ''])
1273+
1274+
normal gg
1275+
1276+
call search('foobar', 'c')
1277+
call assert_equal([1, 1], [line('.'), col('.')])
1278+
1279+
normal j
1280+
call search('^$', 'c')
1281+
call assert_equal([2, 1], [line('.'), col('.')])
1282+
1283+
call search('^$', 'bc')
1284+
call assert_equal([2, 1], [line('.'), col('.')])
1285+
1286+
exe "normal /two\<CR>"
1287+
call search('.', 'c')
1288+
call assert_equal([3, 5], [line('.'), col('.')])
1289+
1290+
close!
1291+
endfunc

src/testdir/test_substitute.vim

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,3 +640,52 @@ func Test_nocatch_sub_failure_handling()
640640

641641
bwipe!
642642
endfunc
643+
644+
" Test ":s/pat/sub/" with different ~s in sub.
645+
func Test_replace_with_tilde()
646+
new
647+
" Set the last replace string to empty
648+
s/^$//
649+
call append(0, ['- Bug in "vPPPP" on this text:'])
650+
normal gg
651+
s/u/~u~/
652+
call assert_equal('- Bug in "vPPPP" on this text:', getline(1))
653+
s/i/~u~/
654+
call assert_equal('- Bug uuun "vPPPP" on this text:', getline(1))
655+
s/o/~~~/
656+
call assert_equal('- Bug uuun "vPPPP" uuuuuuuuun this text:', getline(1))
657+
close!
658+
endfunc
659+
660+
func Test_replace_keeppatterns()
661+
new
662+
a
663+
foobar
664+
665+
substitute foo asdf
666+
667+
one two
668+
.
669+
670+
normal gg
671+
/^substitute
672+
s/foo/bar/
673+
call assert_equal('foo', @/)
674+
call assert_equal('substitute bar asdf', getline('.'))
675+
676+
/^substitute
677+
keeppatterns s/asdf/xyz/
678+
call assert_equal('^substitute', @/)
679+
call assert_equal('substitute bar xyz', getline('.'))
680+
681+
exe "normal /bar /e\<CR>"
682+
call assert_equal(15, col('.'))
683+
normal -
684+
keeppatterns /xyz
685+
call assert_equal('bar ', @/)
686+
call assert_equal('substitute bar xyz', getline('.'))
687+
exe "normal 0dn"
688+
call assert_equal('xyz', getline('.'))
689+
690+
close!
691+
endfunc

src/testdir/test_visual.vim

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,3 +404,27 @@ func Test_curswant_not_changed()
404404
bwipe!
405405
au! InsertLeave
406406
endfunc
407+
408+
" Tests for "vaBiB", end could be wrong.
409+
func Test_Visual_Block()
410+
new
411+
a
412+
- Bug in "vPPPP" on this text:
413+
{
414+
cmd;
415+
{
416+
cmd;\t/* <-- Start cursor here */
417+
{
418+
}
419+
}
420+
}
421+
.
422+
normal gg
423+
call search('Start cursor here')
424+
normal vaBiBD
425+
call assert_equal(['- Bug in "vPPPP" on this text:',
426+
\ "\t{",
427+
\ "\t}"], getline(1, '$'))
428+
429+
close!
430+
endfunc

0 commit comments

Comments
 (0)