patch 8.2.0212: missing search/substitute pattern hardly tested
Problem: Missing search/substitute pattern hardly tested.
Solution: Add test_clear_search_pat() and tests. (Yegappan Lakshmanan,
closes #5579)
diff --git a/src/testdir/test_substitute.vim b/src/testdir/test_substitute.vim
index 4db7b3e..acc59cf 100644
--- a/src/testdir/test_substitute.vim
+++ b/src/testdir/test_substitute.vim
@@ -803,4 +803,19 @@
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