summaryrefslogtreecommitdiff
path: root/src/testdir/test_substitute.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-02-11 22:04:02 +0100
committerBram Moolenaar <Bram@vim.org>2020-02-11 22:04:02 +0100
commit9f6277bdde97b7767ded43a0b5a2023eb601b3b7 (patch)
treef80204a06b9c411a154597c112f51d81a66d1d50 /src/testdir/test_substitute.vim
parent799439a5d85a7d45eff7485056f2798cea766300 (diff)
downloadvim-git-9f6277bdde97b7767ded43a0b5a2023eb601b3b7.tar.gz
patch 8.2.0243: insufficient code coverage for ex_docmd.c functionsv8.2.0243
Problem: Insufficient code coverage for ex_docmd.c functions. Solution: Add more tests. (Yegappan Lakshmanan, closes #5618)
Diffstat (limited to 'src/testdir/test_substitute.vim')
-rw-r--r--src/testdir/test_substitute.vim39
1 files changed, 28 insertions, 11 deletions
diff --git a/src/testdir/test_substitute.vim b/src/testdir/test_substitute.vim
index acc59cf56..2ac6f4541 100644
--- a/src/testdir/test_substitute.vim
+++ b/src/testdir/test_substitute.vim
@@ -1,5 +1,7 @@
" Tests for multi-line regexps with ":s".
+source shared.vim
+
func Test_multiline_subst()
enew!
call append(0, ["1 aa",
@@ -805,17 +807,32 @@ 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
+ let lines =<< trim [SCRIPT]
+ call assert_fails('~', 'E33:')
+ call assert_fails('s//abc/g', 'E476:')
+ call assert_fails('s\/bar', 'E476:')
+ call assert_fails('s\&bar&', 'E476:')
+ call writefile(v:errors, 'Xresult')
+ qall!
+ [SCRIPT]
+ call writefile(lines, 'Xscript')
+ if RunVim([], [], '--clean -S Xscript')
+ call assert_equal([], readfile('Xresult'))
+ endif
+
+ let lines =<< trim [SCRIPT]
+ set cpo+=/
+ call assert_fails('s/abc/%/', 'E33:')
+ call writefile(v:errors, 'Xresult')
+ qall!
+ [SCRIPT]
+ call writefile(lines, 'Xscript')
+ if RunVim([], [], '--clean -S Xscript')
+ call assert_equal([], readfile('Xresult'))
+ endif
+
+ call delete('Xscript')
+ call delete('Xresult')
endfunc
" vim: shiftwidth=2 sts=2 expandtab