1
0
forked from aniani/vim

patch 8.2.3345: some code not covered by tests

Problem:    Some code not covered by tests.
Solution:   Add a few more tests. (Dominique Pellé, closes #8757)
This commit is contained in:
Dominique Pelle
2021-08-14 21:11:51 +02:00
committed by Bram Moolenaar
parent d2e9ccee90
commit bfb2bb16bc
5 changed files with 84 additions and 0 deletions

View File

@@ -943,4 +943,41 @@ func Test_substitute_skipped_range()
bwipe!
endfunc
" Test using the 'gdefault' option (when on, flag 'g' is default on).
func Test_substitute_gdefault()
new
" First check without 'gdefault'
call setline(1, 'foo bar foo')
s/foo/FOO/
call assert_equal('FOO bar foo', getline(1))
call setline(1, 'foo bar foo')
s/foo/FOO/g
call assert_equal('FOO bar FOO', getline(1))
call setline(1, 'foo bar foo')
s/foo/FOO/gg
call assert_equal('FOO bar foo', getline(1))
" Then check with 'gdefault'
set gdefault
call setline(1, 'foo bar foo')
s/foo/FOO/
call assert_equal('FOO bar FOO', getline(1))
call setline(1, 'foo bar foo')
s/foo/FOO/g
call assert_equal('FOO bar foo', getline(1))
call setline(1, 'foo bar foo')
s/foo/FOO/gg
call assert_equal('FOO bar FOO', getline(1))
" Setting 'compatible' should reset 'gdefault'
call assert_equal(1, &gdefault)
set compatible
call assert_equal(0, &gdefault)
set nocompatible
call assert_equal(0, &gdefault)
bw!
endfunc
" vim: shiftwidth=2 sts=2 expandtab