aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir/test_substitute.vim
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/testdir/test_substitute.vim')
-rw-r--r--src/nvim/testdir/test_substitute.vim33
1 files changed, 32 insertions, 1 deletions
diff --git a/src/nvim/testdir/test_substitute.vim b/src/nvim/testdir/test_substitute.vim
index 619b63202a..9a1144b8e4 100644
--- a/src/nvim/testdir/test_substitute.vim
+++ b/src/nvim/testdir/test_substitute.vim
@@ -294,7 +294,7 @@ endfunc
" Test for *:s%* on :substitute.
func Test_sub_cmd_6()
- throw "skipped: Nvim removed POSIX-related 'cpoptions' flags"
+ throw 'Skipped: Nvim does not support cpoptions flag "/"'
set magic&
set cpo+=/
@@ -808,6 +808,37 @@ 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()
+ 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
+
+ " Nvim does not support cpoptions flag "/"'
+ " 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
+
func Test_submatch_list_concatenate()
let pat = 'A\(.\)'
let Rep = {-> string([submatch(0, 1)] + [[submatch(1)]])}