summaryrefslogtreecommitdiff
path: root/src/testdir/test87.in
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2013-05-15 14:39:52 +0200
committerBram Moolenaar <Bram@vim.org>2013-05-15 14:39:52 +0200
commitb6c589a529bc8c5720477494696c6f69fe457475 (patch)
treefa6f512190cb15fa5a0a3186312ede6115881e61 /src/testdir/test87.in
parent46a7561f3a151fefc469225d41822dd0be292f98 (diff)
downloadvim-git-b6c589a529bc8c5720477494696c6f69fe457475.tar.gz
updated for version 7.3.947v7.3.947
Problem: Python: No iterator for vim.list and vim.bufferlist. Solution: Add the iterators. Also fix name of FunctionType. Add tests for vim.buffers. (ZyX)
Diffstat (limited to 'src/testdir/test87.in')
-rw-r--r--src/testdir/test87.in60
1 files changed, 60 insertions, 0 deletions
diff --git a/src/testdir/test87.in b/src/testdir/test87.in
index 6f3cce0fa..f9b8a65fd 100644
--- a/src/testdir/test87.in
+++ b/src/testdir/test87.in
@@ -446,6 +446,9 @@ EOF
: call RecVars(oname)
:endfor
:only
+:for buf in g:bufs[1:]
+: execute 'bwipeout!' buf
+:endfor
:"
:" Test buffer object
:vnew
@@ -488,6 +491,62 @@ for expr in ('b[1]','b[:] = ["A", "B"]','b[:]','b.append("abc")'):
# Should not happen in any case
cb.append('No exception for ' + expr)
EOF
+:"
+:" Test vim.buffers object
+:set hidden
+:edit a
+:buffer #
+:edit b
+:buffer #
+:edit c
+:buffer #
+py3 << EOF
+# Check GCing iterator that was not fully exhausted
+i = iter(vim.buffers)
+cb.append('i:' + str(next(i)))
+# and also check creating more then one iterator at a time
+i2 = iter(vim.buffers)
+cb.append('i2:' + str(next(i2)))
+cb.append('i:' + str(next(i)))
+# The following should trigger GC and not cause any problems
+del i
+del i2
+i3 = iter(vim.buffers)
+cb.append('i3:' + str(next(i3)))
+del i3
+
+prevnum = 0
+for b in vim.buffers:
+ # Check buffer order
+ if prevnum >= b.number:
+ cb.append('!!! Buffer numbers not in strictly ascending order')
+ # Check indexing: vim.buffers[number].number == number
+ cb.append(str(b.number) + ':' + repr(vim.buffers[b.number]) + '=' + repr(b))
+ prevnum = b.number
+
+cb.append(str(len(vim.buffers)))
+
+bnums = list(map(lambda b: b.number, vim.buffers))[1:]
+
+# Test wiping out buffer with existing iterator
+i4 = iter(vim.buffers)
+cb.append('i4:' + str(next(i4)))
+vim.command('bwipeout! ' + str(bnums.pop(0)))
+try:
+ next(i4)
+except vim.error:
+ pass
+else:
+ cb.append('!!!! No vim.error')
+i4 = iter(vim.buffers)
+vim.command('bwipeout! ' + str(bnums.pop(-1)))
+vim.command('bwipeout! ' + str(bnums.pop(-1)))
+cb.append('i4:' + str(next(i4)))
+try:
+ next(i4)
+except StopIteration:
+ cb.append('StopIteration')
+EOF
:endfun
:"
:call Test()
@@ -496,6 +555,7 @@ EOF
:call garbagecollect(1)
:"
:/^start:/,$wq! test.out
+:call getchar()
ENDTEST
start: