Bram Moolenaar | a58883b | 2017-01-29 21:31:09 +0100 | [diff] [blame] | 1 | " Test for python 2 commands. |
| 2 | " TODO: move tests from test87.in here. |
| 3 | |
| 4 | if !has('python') |
| 5 | finish |
| 6 | endif |
| 7 | |
| 8 | func Test_pydo() |
| 9 | " Check deleting lines does not trigger ml_get error. |
| 10 | py import vim |
| 11 | new |
| 12 | call setline(1, ['one', 'two', 'three']) |
| 13 | pydo vim.command("%d_") |
| 14 | bwipe! |
| 15 | |
| 16 | " Check switching to another buffer does not trigger ml_get error. |
| 17 | new |
| 18 | let wincount = winnr('$') |
| 19 | call setline(1, ['one', 'two', 'three']) |
| 20 | pydo vim.command("new") |
| 21 | call assert_equal(wincount + 1, winnr('$')) |
| 22 | bwipe! |
| 23 | bwipe! |
| 24 | endfunc |
Bram Moolenaar | 5390144 | 2018-07-25 22:02:36 +0200 | [diff] [blame] | 25 | |
| 26 | func Test_set_cursor() |
| 27 | " Check that setting the cursor position works. |
| 28 | py import vim |
| 29 | new |
| 30 | call setline(1, ['first line', 'second line']) |
| 31 | normal gg |
| 32 | pydo vim.current.window.cursor = (1, 5) |
| 33 | call assert_equal([1, 6], [line('.'), col('.')]) |
| 34 | |
| 35 | " Check that movement after setting cursor position keeps current column. |
| 36 | normal j |
| 37 | call assert_equal([2, 6], [line('.'), col('.')]) |
| 38 | endfunc |