Patch 8.2.0130
Problem:    Python3 ranges are not tested.
Solution:   Add test. (Dominique Pelle, closes #5498)
Files:      src/testdir/test_python3.vim


*** ../vim-8.2.0129/src/testdir/test_python3.vim        2020-01-02 
16:38:04.184843484 +0100
--- src/testdir/test_python3.vim        2020-01-19 13:57:45.017910461 +0100
***************
*** 187,189 ****
--- 187,236 ----
  
    set encoding=utf8
  endfunc
+ 
+ " Test range objects, see :help python-range
+ func Test_range()
+   new
+   py3 b = vim.current.buffer
+ 
+   call setline(1, range(1, 6))
+   py3 r = b.range(2, 4)
+   call assert_equal(6, py3eval('len(b)'))
+   call assert_equal(3, py3eval('len(r)'))
+   call assert_equal('3', py3eval('b[2]'))
+   call assert_equal('4', py3eval('r[2]'))
+ 
+   call assert_fails('py3 r[3] = "x"', 'IndexError: line number out of range')
+   call assert_fails('py3 x = r[3]', 'IndexError: line number out of range')
+   call assert_fails('py3 r["a"] = "x"', 'TypeError')
+   call assert_fails('py3 x = r["a"]', 'TypeError')
+ 
+   py3 del r[:]
+   call assert_equal(['1', '5', '6'], getline(1, '$'))
+ 
+   %d | call setline(1, range(1, 6))
+   py3 r = b.range(2, 5)
+   py3 del r[2]
+   call assert_equal(['1', '2', '3', '5', '6'], getline(1, '$'))
+ 
+   %d | call setline(1, range(1, 6))
+   py3 r = b.range(2, 4)
+   py3 vim.command("%d,%dnorm Ax" % (r.start + 1, r.end + 1))
+   call assert_equal(['1', '2x', '3x', '4x', '5', '6'], getline(1, '$'))
+ 
+   %d | call setline(1, range(1, 4))
+   py3 r = b.range(2, 3)
+   py3 r.append(['a', 'b'])
+   call assert_equal(['1', '2', '3', 'a', 'b', '4'], getline(1, '$'))
+   py3 r.append(['c', 'd'], 0)
+   call assert_equal(['1', 'c', 'd', '2', '3', 'a', 'b', '4'], getline(1, '$'))
+ 
+   %d | call setline(1, range(1, 5))
+   py3 r = b.range(2, 4)
+   py3 r.append('a')
+   call assert_equal(['1', '2', '3', '4', 'a', '5'], getline(1, '$'))
+   py3 r.append('b', 1)
+   call assert_equal(['1', '2', 'b', '3', '4', 'a', '5'], getline(1, '$'))
+ 
+   bwipe!
+ endfunc
*** ../vim-8.2.0129/src/version.c       2020-01-18 16:10:37.458231310 +0100
--- src/version.c       2020-01-19 13:57:02.534125648 +0100
***************
*** 744,745 ****
--- 744,747 ----
  {   /* Add new patch number below this line */
+ /**/
+     130,
  /**/

-- 
Why I like vim:
> I like VIM because, when I ask a question in this newsgroup, I get a
> one-line answer.  With xemacs, I get a 1Kb lisp script with bugs in it ;-)

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202001191258.00JCwaMf013080%40masaka.moolenaar.net.

Raspunde prin e-mail lui