Mercurial > vim
diff src/testdir/test_terminal.vim @ 16912:a5e3509b33ca v8.1.1457
patch 8.1.1457: cannot reuse a buffer when loading a screen dump
commit https://github.com/vim/vim/commit/87abab92f5b42319a7b10df9974ed3ce5c9b2b9b
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Jun 3 21:14:59 2019 +0200
patch 8.1.1457: cannot reuse a buffer when loading a screen dump
Problem: Cannot reuse a buffer when loading a screen dump.
Solution: Add the "bufnr" option.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 03 Jun 2019 21:30:05 +0200 |
parents | 9c90cf08cfa8 |
children | 8d91579414b8 |
line wrap: on
line diff
--- a/src/testdir/test_terminal.vim +++ b/src/testdir/test_terminal.vim @@ -1119,11 +1119,30 @@ endfunc " just testing basic functionality. func Test_terminal_dumpload() + let curbuf = winbufnr('') call assert_equal(1, winnr('$')) - call term_dumpload('dumps/Test_popup_command_01.dump') + let buf = term_dumpload('dumps/Test_popup_command_01.dump') call assert_equal(2, winnr('$')) call assert_equal(20, line('$')) call Check_dump01(0) + + " Load another dump in the same window + let buf2 = term_dumpload('dumps/Test_diff_01.dump', {'bufnr': buf}) + call assert_equal(buf, buf2) + call assert_notequal('one two three four five', trim(getline(1))) + + " Load the first dump again in the same window + let buf2 = term_dumpload('dumps/Test_popup_command_01.dump', {'bufnr': buf}) + call assert_equal(buf, buf2) + call Check_dump01(0) + + call assert_fails("call term_dumpload('dumps/Test_popup_command_01.dump', {'bufnr': curbuf})", 'E475:') + call assert_fails("call term_dumpload('dumps/Test_popup_command_01.dump', {'bufnr': 9999})", 'E86:') + new + let closedbuf = winbufnr('') + quit + call assert_fails("call term_dumpload('dumps/Test_popup_command_01.dump', {'bufnr': closedbuf})", 'E475:') + quit endfunc