summaryrefslogtreecommitdiffstats
path: root/src/testdir/test_substitute.vim
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-20 03:56:56 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-20 03:56:56 +0000
commit75a9fa68f6cdd6769813a8c5e055bfb00a08c089 (patch)
treedaf1676b4e5ea491b7a370467a24b8181cc21827 /src/testdir/test_substitute.vim
parentAdding upstream version 2:9.1.0377. (diff)
downloadvim-upstream/2%9.1.0496.tar.xz
vim-upstream/2%9.1.0496.zip
Adding upstream version 2:9.1.0496.upstream/2%9.1.0496
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/testdir/test_substitute.vim')
-rw-r--r--src/testdir/test_substitute.vim24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/testdir/test_substitute.vim b/src/testdir/test_substitute.vim
index 7c2bbb4..afdc104 100644
--- a/src/testdir/test_substitute.vim
+++ b/src/testdir/test_substitute.vim
@@ -173,6 +173,16 @@ func Test_substitute_repeat()
call feedkeys("Qsc\<CR>y", 'tx')
bwipe!
endfunc
+
+" Test :s with ? as delimiter.
+func Test_substitute_question_delimiter()
+ new
+ call setline(1, '??:??')
+ %s?\?\??!!?g
+ call assert_equal('!!:!!', getline(1))
+ bwipe!
+endfunc
+
" Test %s/\n// which is implemented as a special case to use a
" more efficient join rather than doing a regular substitution.
func Test_substitute_join()
@@ -1498,4 +1508,18 @@ func Test_substitute_expr_recursive()
exe bufnr .. "bw!"
endfunc
+" Test for changing 'cpo' in a substitute expression
+func Test_substitute_expr_cpo()
+ func XSubExpr()
+ set cpo=
+ return 'x'
+ endfunc
+
+ let save_cpo = &cpo
+ call assert_equal('xxx', substitute('abc', '.', '\=XSubExpr()', 'g'))
+ call assert_equal(save_cpo, &cpo)
+
+ delfunc XSubExpr
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab