diff options
author | Bram Moolenaar <Bram@vim.org> | 2013-05-12 21:16:23 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2013-05-12 21:16:23 +0200 |
commit | bd80f35bc59442894a4ec56aefb0137cb0a350fa (patch) | |
tree | b822da2358409f0c5da3b1d2c266c58f5f70a536 /src/testdir/test86.in | |
parent | 8f1723de4735e437b4ced3be95d6582e713c3d7d (diff) | |
download | vim-git-bd80f35bc59442894a4ec56aefb0137cb0a350fa.tar.gz |
updated for version 7.3.943v7.3.943
Problem: Python: Negative indices were failing.
Solution: Fix negative indices. Add tests. (ZyX)
Diffstat (limited to 'src/testdir/test86.in')
-rw-r--r-- | src/testdir/test86.in | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/src/testdir/test86.in b/src/testdir/test86.in index ca4480754..555a5fdf5 100644 --- a/src/testdir/test86.in +++ b/src/testdir/test86.in @@ -475,9 +475,50 @@ EOF : endtry : endfor : call RecVars(oname) -endtry :endfor :only +:" +:" Test buffer object +:vnew +:put ='First line' +:put ='Second line' +:put ='Third line' +:1 delete _ +:py b=vim.current.buffer +:wincmd w +:mark a +py << EOF +cb = vim.current.buffer +# Tests BufferAppend and BufferItem +cb.append(b[0]) +# Tests BufferSlice and BufferAssSlice +cb.append('abc') # Will be overwritten +cb[-1:] = b[:-2] +# Test BufferLength and BufferAssSlice +cb.append('def') # Will not be overwritten +cb[len(cb):] = b[:] +# Test BufferAssItem and BufferMark +cb.append('ghi') # Will be overwritten +cb[-1] = repr((len(cb) - cb.mark('a')[0], cb.mark('a')[1])) +# Test BufferRepr +cb.append(repr(cb) + repr(b)) +# Modify foreign buffer +b.append('foo') +b[0]='bar' +b[0:0]=['baz'] +vim.command('call append("$", getbufline(%i, 1, "$"))' % b.number) +# Test CheckBuffer +vim.command('bwipeout! ' + str(b.number)) +for expr in ('b[1]','b[:] = ["A", "B"]','b[:]','b.append("abc")'): + try: + exec(expr) + except vim.error: + pass + else: + # Usually a SEGV here + # Should not happen in any case + cb.append('No exception for ' + expr) +EOF :endfun :" :call Test() |