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.vim50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_substitute.vim b/src/nvim/testdir/test_substitute.vim
index bd44079882..619b63202a 100644
--- a/src/nvim/testdir/test_substitute.vim
+++ b/src/nvim/testdir/test_substitute.vim
@@ -1,5 +1,7 @@
" Tests for the substitute (:s) command
+source shared.vim
+
func Test_multiline_subst()
enew!
call append(0, ["1 aa",
@@ -851,6 +853,54 @@ func Test_sub_change_window()
delfunc Repl
endfunc
+" This was undoign a change in between computing the length and using it.
+func Do_Test_sub_undo_change()
+ new
+ norm o0000000000000000000000000000000000000000000000000000
+ silent! s/\%')/\=Repl()
+ bwipe!
+endfunc
+
+func Test_sub_undo_change()
+ func Repl()
+ silent! norm g-
+ endfunc
+ call Do_Test_sub_undo_change()
+
+ func! Repl()
+ silent earlier
+ endfunc
+ call Do_Test_sub_undo_change()
+
+ delfunc Repl
+endfunc
+
+" This was opening a command line window from the expression
+func Test_sub_open_cmdline_win()
+ " the error only happens in a very specific setup, run a new Vim instance to
+ " get a clean starting point.
+ let lines =<< trim [SCRIPT]
+ set vb t_vb=
+ norm o0000000000000000000000000000000000000000000000000000
+ func Replace()
+ norm q/
+ endfunc
+ s/\%')/\=Replace()
+ redir >Xresult
+ messages
+ redir END
+ qall!
+ [SCRIPT]
+ call writefile(lines, 'Xscript')
+ if RunVim([], [], '-u NONE -S Xscript')
+ call assert_match('E565: Not allowed to change text or change window',
+ \ readfile('Xresult')->join('XX'))
+ endif
+
+ call delete('Xscript')
+ call delete('Xresult')
+endfunc
+
" Test for the 2-letter and 3-letter :substitute commands
func Test_substitute_short_cmd()
new