Skip to content

Commit 66669fc

Browse files
committed
patch 8.2.1955: Vim9: not all command modifiers are tested
Problem: Vim9: not all command modifiers are tested. Solution: Add tests for remaining modifiers.
1 parent f65b35b commit 66669fc

2 files changed

Lines changed: 58 additions & 21 deletions

File tree

src/testdir/test_vim9_cmd.vim

Lines changed: 56 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -478,15 +478,62 @@ def Test_command_modifiers_keep()
478478
enddef
479479

480480
def Test_command_modifier_other()
481-
# TODO
482-
# hide
483-
# noautocmd
484-
# noswapfile
485-
# sandbox
486-
# silent
487-
# silent!
488-
# unsilent
489-
# verbose
481+
new Xsomefile
482+
setline(1, 'changed')
483+
var buf = bufnr()
484+
hide edit Xotherfile
485+
var info = getbufinfo(buf)
486+
assert_equal(1, info[0].hidden)
487+
assert_equal(1, info[0].changed)
488+
edit Xsomefile
489+
bwipe!
490+
491+
au BufNewFile Xfile g:readFile = 1
492+
g:readFile = 0
493+
edit Xfile
494+
assert_equal(1, g:readFile)
495+
bwipe!
496+
g:readFile = 0
497+
noautocmd edit Xfile
498+
assert_equal(0, g:readFile)
499+
500+
noswapfile edit XnoSwap
501+
assert_equal(0, &l:swapfile)
502+
bwipe!
503+
504+
var caught = false
505+
try
506+
sandbox !ls
507+
catch /E48:/
508+
caught = true
509+
endtry
510+
assert_true(caught)
511+
512+
:8verbose g:verbose_now = &verbose
513+
assert_equal(8, g:verbose_now)
514+
unlet g:verbose_now
515+
enddef
516+
517+
def EchoHere()
518+
echomsg 'here'
519+
enddef
520+
def EchoThere()
521+
unsilent echomsg 'there'
522+
enddef
523+
524+
def Test_modifier_silent_unsilent()
525+
echomsg 'last one'
526+
silent echomsg "text"
527+
assert_equal("\nlast one", execute(':1messages'))
528+
529+
silent! echoerr "error"
530+
531+
echomsg 'last one'
532+
silent EchoHere()
533+
assert_equal("\nlast one", execute(':1messages'))
534+
535+
silent EchoThere()
536+
assert_equal("\nthere", execute(':1messages'))
490537
enddef
491538

492539
def Test_range_after_command_modifier()
@@ -587,17 +634,5 @@ def Test_f_args()
587634
CheckScriptSuccess(lines)
588635
enddef
589636

590-
def Test_modifier_silent()
591-
echomsg 'last one'
592-
silent echomsg "text"
593-
redir => g:testmsg
594-
:1messages
595-
redir END
596-
assert_equal("\nlast one", g:testmsg)
597-
unlet g:testmsg
598-
599-
silent! echoerr "error"
600-
enddef
601-
602637

603638
" vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,8 @@ static char *(features[]) =
750750

751751
static int included_patches[] =
752752
{ /* Add new patch number below this line */
753+
/**/
754+
1955,
753755
/**/
754756
1954,
755757
/**/

0 commit comments

Comments
 (0)