comparison src/testdir/test_substitute.vim @ 19370:02111977dd05 v8.2.0243

patch 8.2.0243: insufficient code coverage for ex_docmd.c functions Commit: https://github.com/vim/vim/commit/9f6277bdde97b7767ded43a0b5a2023eb601b3b7 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Feb 11 22:04:02 2020 +0100 patch 8.2.0243: insufficient code coverage for ex_docmd.c functions Problem: Insufficient code coverage for ex_docmd.c functions. Solution: Add more tests. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/5618)
author Bram Moolenaar <Bram@vim.org>
date Tue, 11 Feb 2020 22:15:04 +0100
parents 6fd567c927c0
children 546bdeef35f1
comparison
equal deleted inserted replaced
19369:05c259d4233d 19370:02111977dd05
1 " Tests for multi-line regexps with ":s". 1 " Tests for multi-line regexps with ":s".
2
3 source shared.vim
2 4
3 func Test_multiline_subst() 5 func Test_multiline_subst()
4 enew! 6 enew!
5 call append(0, ["1 aa", 7 call append(0, ["1 aa",
6 \ "bb", 8 \ "bb",
803 close! 805 close!
804 endfunc 806 endfunc
805 807
806 " Test for command failures when the last substitute pattern is not set. 808 " Test for command failures when the last substitute pattern is not set.
807 func Test_sub_with_no_last_pat() 809 func Test_sub_with_no_last_pat()
808 call test_clear_search_pat() 810 let lines =<< trim [SCRIPT]
809 call assert_fails('~', 'E33:') 811 call assert_fails('~', 'E33:')
810 call assert_fails('s//abc/g', 'E476:') 812 call assert_fails('s//abc/g', 'E476:')
811 call assert_fails('s\/bar', 'E476:') 813 call assert_fails('s\/bar', 'E476:')
812 call assert_fails('s\&bar&', 'E476:') 814 call assert_fails('s\&bar&', 'E476:')
813 815 call writefile(v:errors, 'Xresult')
814 call test_clear_search_pat() 816 qall!
815 let save_cpo = &cpo 817 [SCRIPT]
816 set cpo+=/ 818 call writefile(lines, 'Xscript')
817 call assert_fails('s/abc/%/', 'E33:') 819 if RunVim([], [], '--clean -S Xscript')
818 let &cpo = save_cpo 820 call assert_equal([], readfile('Xresult'))
821 endif
822
823 let lines =<< trim [SCRIPT]
824 set cpo+=/
825 call assert_fails('s/abc/%/', 'E33:')
826 call writefile(v:errors, 'Xresult')
827 qall!
828 [SCRIPT]
829 call writefile(lines, 'Xscript')
830 if RunVim([], [], '--clean -S Xscript')
831 call assert_equal([], readfile('Xresult'))
832 endif
833
834 call delete('Xscript')
835 call delete('Xresult')
819 endfunc 836 endfunc
820 837
821 " vim: shiftwidth=2 sts=2 expandtab 838 " vim: shiftwidth=2 sts=2 expandtab