Mercurial > vim
diff src/testdir/test_channel.vim @ 9147:053bc64433ec v7.4.1857
commit https://github.com/vim/vim/commit/9f5842e63fc63d438cbffcec503e072a06f74dc2
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun May 29 16:17:08 2016 +0200
patch 7.4.1857
Problem: When a channel appends to a buffer that is 'nomodifiable' there is
an error but appending is done anyway.
Solution: Add the 'modifiable' option. Refuse to write to a 'nomodifiable'
when the value is 1.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 29 May 2016 16:30:06 +0200 |
parents | d319453f62b3 |
children | fb1a19011fbe |
line wrap: on
line diff
--- a/src/testdir/test_channel.vim +++ b/src/testdir/test_channel.vim @@ -676,7 +676,7 @@ func Test_nl_write_both_file() endtry endfunc -func Run_test_pipe_to_buffer(use_name) +func Run_test_pipe_to_buffer(use_name, nomod) if !has('job') return endif @@ -691,6 +691,9 @@ func Run_test_pipe_to_buffer(use_name) quit let firstline = '' endif + if a:nomod + let options['out_modifiable'] = 0 + endif let job = job_start(s:python . " test_channel_pipe.py", options) call assert_equal("run", job_status(job)) try @@ -705,6 +708,11 @@ func Run_test_pipe_to_buffer(use_name) $del endif call assert_equal([firstline, 'line one', 'line two', 'this', 'AND this', 'Goodbye!'], getline(1, '$')) + if a:nomod + call assert_equal(0, &modifiable) + else + call assert_equal(1, &modifiable) + endif bwipe! finally call job_stop(job) @@ -712,14 +720,18 @@ func Run_test_pipe_to_buffer(use_name) endfunc func Test_pipe_to_buffer_name() - call Run_test_pipe_to_buffer(1) + call Run_test_pipe_to_buffer(1, 0) endfunc func Test_pipe_to_buffer_nr() - call Run_test_pipe_to_buffer(0) + call Run_test_pipe_to_buffer(0, 0) endfunc -func Run_test_pipe_err_to_buffer(use_name) +func Test_pipe_to_buffer_name_nomod() + call Run_test_pipe_to_buffer(1, 1) +endfunc + +func Run_test_pipe_err_to_buffer(use_name, nomod) if !has('job') return endif @@ -734,6 +746,9 @@ func Run_test_pipe_err_to_buffer(use_nam quit let firstline = '' endif + if a:nomod + let options['err_modifiable'] = 0 + endif let job = job_start(s:python . " test_channel_pipe.py", options) call assert_equal("run", job_status(job)) try @@ -745,6 +760,11 @@ func Run_test_pipe_err_to_buffer(use_nam sp pipe-err call s:waitFor('line("$") >= 5') call assert_equal([firstline, 'line one', 'line two', 'this', 'AND this'], getline(1, '$')) + if a:nomod + call assert_equal(0, &modifiable) + else + call assert_equal(1, &modifiable) + endif bwipe! finally call job_stop(job) @@ -752,11 +772,15 @@ func Run_test_pipe_err_to_buffer(use_nam endfunc func Test_pipe_err_to_buffer_name() - call Run_test_pipe_err_to_buffer(1) + call Run_test_pipe_err_to_buffer(1, 0) endfunc func Test_pipe_err_to_buffer_nr() - call Run_test_pipe_err_to_buffer(0) + call Run_test_pipe_err_to_buffer(0, 0) +endfunc + +func Test_pipe_err_to_buffer_name_nomod() + call Run_test_pipe_err_to_buffer(1, 1) endfunc func Test_pipe_both_to_buffer()