aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-04-18 14:09:29 +0800
committerzeertzjq <zeertzjq@outlook.com>2023-04-18 14:20:44 +0800
commitc0f10d3fe018990b68cfa47bd84693449100f449 (patch)
tree43d0a05dfa50126d915c7ea86482fc139d210855 /test
parent240c41e1af556cd17329d5c46d26a3ca91be2db8 (diff)
downloadrneovim-c0f10d3fe018990b68cfa47bd84693449100f449.tar.gz
rneovim-c0f10d3fe018990b68cfa47bd84693449100f449.tar.bz2
rneovim-c0f10d3fe018990b68cfa47bd84693449100f449.zip
vim-patch:9.0.0783: ":!" doesn't do anything but does update the previous command
Problem: ":!" doesn't do anything but does update the previous command. Solution: Do not have ":!" change the previous command. (Martin Tournoij, closes vim/vim#11372) https://github.com/vim/vim/commit/8107a2a8af80a53a61734b600539c5beb4782991 Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'test')
-rw-r--r--test/old/testdir/test_shell.vim31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/old/testdir/test_shell.vim b/test/old/testdir/test_shell.vim
index 3d0056bfc1..b65752dbf2 100644
--- a/test/old/testdir/test_shell.vim
+++ b/test/old/testdir/test_shell.vim
@@ -206,4 +206,35 @@ func Test_set_shell()
call delete('Xtestout')
endfunc
+func Test_shell_repeat()
+ CheckUnix
+
+ let save_shell = &shell
+
+ call writefile(['#!/bin/sh', 'echo "Cmd: [$*]" > Xlog'], 'Xtestshell', 'D')
+ call setfperm('Xtestshell', "r-x------")
+ set shell=./Xtestshell
+ defer delete('Xlog')
+
+ call feedkeys(":!echo coconut\<CR>", 'xt') " Run command
+ call assert_equal(['Cmd: [-c echo coconut]'], readfile('Xlog'))
+
+ call feedkeys(":!!\<CR>", 'xt') " Re-run previous
+ call assert_equal(['Cmd: [-c echo coconut]'], readfile('Xlog'))
+
+ call writefile(['empty'], 'Xlog')
+ call feedkeys(":!\<CR>", 'xt') " :! is a no-op
+ call assert_equal(['empty'], readfile('Xlog'))
+
+ call feedkeys(":!!\<CR>", 'xt') " :! doesn't clear previous command
+ call assert_equal(['Cmd: [-c echo coconut]'], readfile('Xlog'))
+
+ call feedkeys(":!echo banana\<CR>", 'xt') " Make sure setting previous command keeps working after a :! no-op
+ call assert_equal(['Cmd: [-c echo banana]'], readfile('Xlog'))
+ call feedkeys(":!!\<CR>", 'xt')
+ call assert_equal(['Cmd: [-c echo banana]'], readfile('Xlog'))
+
+ let &shell = save_shell
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab