comparison src/testdir/test87.in @ 4389:736b8e18a3bc v7.3.943

updated for version 7.3.943 Problem: Python: Negative indices were failing. Solution: Fix negative indices. Add tests. (ZyX)
author Bram Moolenaar <bram@vim.org>
date Sun, 12 May 2013 21:16:23 +0200
parents 7eaccdaa5304
children a84f21892563
comparison
equal deleted inserted replaced
4388:a38216d77e73 4389:736b8e18a3bc
442 : catch 442 : catch
443 : put =' del '.v.'! '.v:exception 443 : put =' del '.v.'! '.v:exception
444 : endtry 444 : endtry
445 : endfor 445 : endfor
446 : call RecVars(oname) 446 : call RecVars(oname)
447 endtry
448 :endfor 447 :endfor
449 :only 448 :only
449 :"
450 :" Test buffer object
451 :vnew
452 :put ='First line'
453 :put ='Second line'
454 :put ='Third line'
455 :1 delete _
456 :py3 b=vim.current.buffer
457 :wincmd w
458 :mark a
459 py3 << EOF
460 cb = vim.current.buffer
461 # Tests BufferAppend and BufferItem
462 cb.append(b[0])
463 # Tests BufferSlice and BufferAssSlice
464 cb.append('abc') # Will be overwritten
465 cb[-1:] = b[:-2]
466 # Test BufferLength and BufferAssSlice
467 cb.append('def') # Will not be overwritten
468 cb[len(cb):] = b[:]
469 # Test BufferAssItem and BufferMark
470 cb.append('ghi') # Will be overwritten
471 cb[-1] = repr((len(cb) - cb.mark('a')[0], cb.mark('a')[1]))
472 # Test BufferRepr
473 cb.append(repr(cb) + repr(b))
474 # Modify foreign buffer
475 b.append('foo')
476 b[0]='bar'
477 b[0:0]=['baz']
478 vim.command('call append("$", getbufline(%i, 1, "$"))' % b.number)
479 # Test CheckBuffer
480 vim.command('bwipeout! ' + str(b.number))
481 for expr in ('b[1]','b[:] = ["A", "B"]','b[:]','b.append("abc")'):
482 try:
483 exec(expr)
484 except vim.error:
485 pass
486 else:
487 # Usually a SEGV here
488 # Should not happen in any case
489 cb.append('No exception for ' + expr)
490 EOF
450 :endfun 491 :endfun
451 :" 492 :"
452 :call Test() 493 :call Test()
453 :" 494 :"
454 :delfunc Test 495 :delfunc Test