To: vim_dev@googlegroups.com Subject: Patch 8.2.1151 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.1151 Problem: Insufficient test coverage for Python. Solution: Add more test cases. (Yegappan Lakshmanan, closes #6415) Files: src/testdir/test_python2.vim, src/testdir/test_python3.vim *** ../vim-8.2.1150/src/testdir/test_python2.vim 2020-07-07 20:12:48.472693157 +0200 --- src/testdir/test_python2.vim 2020-07-07 20:49:02.431026557 +0200 *************** *** 623,628 **** --- 623,631 ---- py l = vim.bindeval('l') py l[2:2:1] = () call assert_equal([0, 1, 2, 3, 4, 5, 6, 7], l) + + call AssertException(["py x = l[10:11:0]"], + \ "Vim(python):ValueError: slice step cannot be zero") endfunc " Locked variables *************** *** 809,814 **** --- 812,821 ---- call assert_equal(0, pyeval("vim.bindeval('v:false')")) call assert_equal(v:none, pyeval("vim.bindeval('v:null')")) call assert_equal(v:none, pyeval("vim.bindeval('v:none')")) + + " channel/job + call assert_equal(v:none, pyeval("vim.bindeval('test_null_channel()')")) + call assert_equal(v:none, pyeval("vim.bindeval('test_null_job()')")) endfunc " threading *************** *** 1402,1407 **** --- 1409,1428 ---- call assert_equal([], pyeval('b[2:0]')) call assert_equal([], pyeval('b[10:12]')) call assert_equal([], pyeval('b[-10:-8]')) + call AssertException(["py x = b[0:3:0]"], + \ "Vim(python):TypeError: sequence index must be integer, not 'slice'") + call AssertException(["py b[0:3:0] = 'abc'"], + \ "Vim(python):TypeError: sequence index must be integer, not 'slice'") + call AssertException(["py x = b[{}]"], + \ "Vim(python):TypeError: sequence index must be integer, not 'dict'") + call AssertException(["py b[{}] = 'abc'"], + \ "Vim(python):TypeError: sequence index must be integer, not 'dict'") + + " Test for getting lines using a range + call AssertException(["py x = b.range(0,3)[0:2:0]"], + \ "Vim(python):TypeError: sequence index must be integer, not 'slice'") + call AssertException(["py b.range(0,3)[0:2:0] = 'abc'"], + \ "Vim(python):TypeError: sequence index must be integer, not 'slice'") " Tests BufferAppend and BufferItem py cb.append(b[0]) *************** *** 1512,1517 **** --- 1533,1541 ---- py vim.current.buffer[:] = [] call assert_equal([''], getline(1, '$')) + " Test for buffer marks + call assert_equal(v:none, pyeval("vim.current.buffer.mark('r')")) + " Test for modifying a 'nomodifiable' buffer setlocal nomodifiable call AssertException(["py vim.current.buffer[0] = 'abc'"], *************** *** 2408,2413 **** --- 2432,2438 ---- call assert_equal(['testdir', 'Xfile', 'src', 'testdir/Xfile', 'testdir', \ 'Xfile'], getline(2, '$')) close! + call AssertException(["py vim.chdir(None)"], "Vim(python):TypeError:") endfunc " Test errors *** ../vim-8.2.1150/src/testdir/test_python3.vim 2020-07-07 20:12:48.472693157 +0200 --- src/testdir/test_python3.vim 2020-07-07 20:49:02.431026557 +0200 *************** *** 798,803 **** --- 798,806 ---- py3 l = vim.bindeval('l') py3 l[2:2:1] = () call assert_equal([0, 1, 2, 3, 4, 5, 6, 7], l) + + call AssertException(["py3 x = l[10:11:0]"], + \ "Vim(py3):ValueError: slice step cannot be zero") endfunc " Locked variables *************** *** 987,992 **** --- 990,999 ---- call assert_equal(0, py3eval("vim.bindeval('v:false')")) call assert_equal(v:none, py3eval("vim.bindeval('v:null')")) call assert_equal(v:none, py3eval("vim.bindeval('v:none')")) + + " channel/job + call assert_equal(v:none, py3eval("vim.bindeval('test_null_channel()')")) + call assert_equal(v:none, py3eval("vim.bindeval('test_null_job()')")) endfunc " threading *************** *** 1580,1585 **** --- 1587,1606 ---- call assert_equal([], py3eval('b[2:0]')) call assert_equal([], py3eval('b[10:12]')) call assert_equal([], py3eval('b[-10:-8]')) + call AssertException(["py3 x = b[0:3:0]"], + \ 'Vim(py3):ValueError: slice step cannot be zero') + call AssertException(["py3 b[0:3:0] = 'abc'"], + \ 'Vim(py3):ValueError: slice step cannot be zero') + call AssertException(["py3 x = b[{}]"], + \ 'Vim(py3):TypeError: index must be int or slice, not dict') + call AssertException(["py3 b[{}] = 'abc'"], + \ 'Vim(py3):TypeError: index must be int or slice, not dict') + + " Test for getting lines using a range + call AssertException(["py3 x = b.range(0,3)[0:2:0]"], + \ "Vim(py3):ValueError: slice step cannot be zero") + call AssertException(["py3 b.range(0,3)[0:2:0] = 'abc'"], + \ "Vim(py3):ValueError: slice step cannot be zero") " Tests BufferAppend and BufferItem py3 cb.append(b[0]) *************** *** 1690,1695 **** --- 1711,1719 ---- py3 vim.current.buffer[:] = [] call assert_equal([''], getline(1, '$')) + " Test for buffer marks + call assert_equal(v:none, py3eval("vim.current.buffer.mark('r')")) + " Test for modifying a 'nomodifiable' buffer setlocal nomodifiable call AssertException(["py3 vim.current.buffer[0] = 'abc'"], *************** *** 2578,2583 **** --- 2602,2608 ---- call assert_equal(["b'testdir'", 'Xfile', "b'src'", 'testdir/Xfile', \"b'testdir'", 'Xfile'], getline(2, '$')) close! + call AssertException(["py3 vim.chdir(None)"], "Vim(py3):TypeError:") endfunc " Test errors *** ../vim-8.2.1150/src/version.c 2020-07-07 20:12:48.472693157 +0200 --- src/version.c 2020-07-07 20:50:07.134841381 +0200 *************** *** 756,757 **** --- 756,759 ---- { /* Add new patch number below this line */ + /**/ + 1151, /**/ -- Git catch 22: "merge is not possible because you have unmerged files." /// Bram Moolenaar -- Bram@Moolenaar.net -- 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 ///