diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2022-08-15 22:17:05 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-15 22:17:05 +0800 |
| commit | 6b686e7e1e09a048bd8e99e86d052d713f9ec30e (patch) | |
| tree | 77bbeb8298ce2bb4483f748ddd40808889776239 /src/nvim/testdir/test_substitute.vim | |
| parent | cbb2e634c9da7cc6e5fe6f18539ab7deb9d67915 (diff) | |
| parent | 747dec7925e130e754cf5ef1db87dd8747923514 (diff) | |
| download | rneovim-6b686e7e1e09a048bd8e99e86d052d713f9ec30e.tar.gz rneovim-6b686e7e1e09a048bd8e99e86d052d713f9ec30e.tar.bz2 rneovim-6b686e7e1e09a048bd8e99e86d052d713f9ec30e.zip | |
Merge pull request #19785 from zeertzjq/vim-8.2.1803
vim-patch:8.2.{1803,3345,3392}
Diffstat (limited to 'src/nvim/testdir/test_substitute.vim')
| -rw-r--r-- | src/nvim/testdir/test_substitute.vim | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_substitute.vim b/src/nvim/testdir/test_substitute.vim index f795d1c0cf..b3a80072d9 100644 --- a/src/nvim/testdir/test_substitute.vim +++ b/src/nvim/testdir/test_substitute.vim @@ -858,6 +858,44 @@ 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 + set nogdefault + call assert_equal(0, &gdefault) + set nocompatible + call assert_equal(0, &gdefault) + + bw! +endfunc + " This was using "old_sub" after it was freed. func Test_using_old_sub() " set compatible maxfuncdepth=10 |