summaryrefslogtreecommitdiff
path: root/src/testdir
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-08-05 20:40:03 +0200
committerBram Moolenaar <Bram@vim.org>2021-08-05 20:40:03 +0200
commit63b9173693015b135aad8e3657bef5e7f776787e (patch)
tree562fd413b11ae6a4c45f39538b89ec881aebf2cb /src/testdir
parentaf647e76cacc60d3cfc5df3ff5b3d9d4b69b519d (diff)
downloadvim-git-8.2.3297.tar.gz
patch 8.2.3297: cannot use all commands inside a {} blockv8.2.3297
Problem: Cannot use all commands inside a {} block after :command and :autocmd. Solution: Do consider \n to separate commands. (closes #8620)
Diffstat (limited to 'src/testdir')
-rw-r--r--src/testdir/test_autocmd.vim8
-rw-r--r--src/testdir/test_usercommands.vim8
2 files changed, 16 insertions, 0 deletions
diff --git a/src/testdir/test_autocmd.vim b/src/testdir/test_autocmd.vim
index 4a7dd60f6..b2e4952be 100644
--- a/src/testdir/test_autocmd.vim
+++ b/src/testdir/test_autocmd.vim
@@ -2816,11 +2816,19 @@ func Test_autocmd_with_block()
setlocal matchpairs+=<:>
/<start
}
+ au CursorHold * {
+ autocmd BufReadPre * ++once echo 'one' | echo 'two'
+ g:gotSafeState = 77
+ }
augroup END
let expected = "\n--- Autocommands ---\nblock_testing BufRead\n *.xml {^@ setlocal matchpairs+=<:>^@ /<start^@ }"
call assert_equal(expected, execute('au BufReadPost *.xml'))
+ doautocmd CursorHold
+ call assert_equal(77, g:gotSafeState)
+ unlet g:gotSafeState
+
augroup block_testing
au!
augroup END
diff --git a/src/testdir/test_usercommands.vim b/src/testdir/test_usercommands.vim
index 173b23ed2..9cb592e23 100644
--- a/src/testdir/test_usercommands.vim
+++ b/src/testdir/test_usercommands.vim
@@ -645,6 +645,14 @@ func Test_usercmd_with_block()
echo 'hello'
END
call CheckScriptFailure(lines, 'E1026:')
+
+ let lines =<< trim END
+ command BarCommand {
+ echo 'hello' | echo 'there'
+ }
+ BarCommand
+ END
+ call CheckScriptFailure(lines, 'E1231:')
endfunc
" vim: shiftwidth=2 sts=2 expandtab