Mercurial > vim
diff src/testdir/test_substitute.vim @ 25617:28f1b7c38ba1 v8.2.3345
patch 8.2.3345: some code not covered by tests
Commit: https://github.com/vim/vim/commit/bfb2bb16bc69441fa3ec13caacb2c94637a8a0ec
Author: Dominique Pelle <dominique.pelle@gmail.com>
Date: Sat Aug 14 21:11:51 2021 +0200
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 https://github.com/vim/vim/issues/8757)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 14 Aug 2021 21:15:02 +0200 |
parents | b1093c1ac109 |
children | b4c147ad4912 |
line wrap: on
line diff
--- a/src/testdir/test_substitute.vim +++ b/src/testdir/test_substitute.vim @@ -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