diff options
Diffstat (limited to 'src/testdir/test_excmd.vim')
-rw-r--r-- | src/testdir/test_excmd.vim | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/src/testdir/test_excmd.vim b/src/testdir/test_excmd.vim index 47fc267..221ceb0 100644 --- a/src/testdir/test_excmd.vim +++ b/src/testdir/test_excmd.vim @@ -3,6 +3,7 @@ source check.vim source shared.vim source term_util.vim +source screendump.vim func Test_ex_delete() new @@ -84,18 +85,27 @@ endfunc " Test for the :drop command func Test_drop_cmd() call writefile(['L1', 'L2'], 'Xdropfile', 'D') + " Test for reusing the current buffer enew | only + let expected_nr = bufnr() drop Xdropfile + call assert_equal(expected_nr, bufnr()) call assert_equal('L2', getline(2)) " Test for switching to an existing window below new drop Xdropfile call assert_equal(1, winnr()) - " Test for splitting the current window + " Test for splitting the current window (set nohidden) enew | only set modified drop Xdropfile call assert_equal(2, winnr('$')) + " Not splitting the current window even if modified (set hidden) + set hidden + enew | only + set modified + drop Xdropfile + call assert_equal(1, winnr('$')) " Check for setting the argument list call assert_equal(['Xdropfile'], argv()) enew | only! @@ -729,4 +739,19 @@ func Test_ex_address_range_overflow() call assert_fails(':--+foobar', 'E492:') endfunc +func Test_drop_modified_file() + CheckScreendump + let lines =<< trim END + call setline(1, 'The quick brown fox jumped over the lazy dogs') + END + call writefile([''], 'Xdrop_modified.txt', 'D') + call writefile(lines, 'Xtest_drop_modified', 'D') + let buf = RunVimInTerminal('-S Xtest_drop_modified Xdrop_modified.txt', {'rows': 10,'columns': 40}) + call term_sendkeys(buf, ":drop Xdrop_modified.txt\<CR>") + call VerifyScreenDump(buf, 'Test_drop_modified_1', {}) + + " clean up + call StopVimInTerminal(buf) +endfunc + " vim: shiftwidth=2 sts=2 expandtab |