summaryrefslogtreecommitdiff
path: root/src/testdir/test_substitute.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-02-05 20:38:22 +0100
committerBram Moolenaar <Bram@vim.org>2020-02-05 20:38:22 +0100
commit07ada5ff2fd8f22ed3233ae5c4ddf87c7b3f56fe (patch)
tree0be9740166fea1f37b2a447558c7eed059b5a671 /src/testdir/test_substitute.vim
parent94255df057afa0b7dde77612f3274d4440871bd1 (diff)
downloadvim-git-07ada5ff2fd8f22ed3233ae5c4ddf87c7b3f56fe.tar.gz
patch 8.2.0212: missing search/substitute pattern hardly testedv8.2.0212
Problem: Missing search/substitute pattern hardly tested. Solution: Add test_clear_search_pat() and tests. (Yegappan Lakshmanan, closes #5579)
Diffstat (limited to 'src/testdir/test_substitute.vim')
-rw-r--r--src/testdir/test_substitute.vim15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/testdir/test_substitute.vim b/src/testdir/test_substitute.vim
index 4db7b3ea4..acc59cf56 100644
--- a/src/testdir/test_substitute.vim
+++ b/src/testdir/test_substitute.vim
@@ -803,4 +803,19 @@ func Test_sub_expand_text()
close!
endfunc
+" Test for command failures when the last substitute pattern is not set.
+func Test_sub_with_no_last_pat()
+ call test_clear_search_pat()
+ call assert_fails('~', 'E33:')
+ call assert_fails('s//abc/g', 'E476:')
+ call assert_fails('s\/bar', 'E476:')
+ call assert_fails('s\&bar&', 'E476:')
+
+ call test_clear_search_pat()
+ let save_cpo = &cpo
+ set cpo+=/
+ call assert_fails('s/abc/%/', 'E33:')
+ let &cpo = save_cpo
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab