|
| 1 | +" Test the ":move" command. |
| 2 | + |
| 3 | +func Test_move() |
| 4 | + enew! |
| 5 | + call append(0, ['line 1', 'line 2', 'line 3']) |
| 6 | + g /^$/ delete _ |
| 7 | + set nomodified |
| 8 | + |
| 9 | + move . |
| 10 | + call assert_equal(['line 1', 'line 2', 'line 3'], getline(1, 3)) |
| 11 | + call assert_false(&modified) |
| 12 | + |
| 13 | + 1,2move 0 |
| 14 | + call assert_equal(['line 1', 'line 2', 'line 3'], getline(1, 3)) |
| 15 | + call assert_false(&modified) |
| 16 | + |
| 17 | + 1,3move 3 |
| 18 | + call assert_equal(['line 1', 'line 2', 'line 3'], getline(1, 3)) |
| 19 | + call assert_false(&modified) |
| 20 | + |
| 21 | + 1move 2 |
| 22 | + call assert_equal(['line 2', 'line 1', 'line 3'], getline(1, 3)) |
| 23 | + call assert_true(&modified) |
| 24 | + set nomodified |
| 25 | + |
| 26 | + 3move 0 |
| 27 | + call assert_equal(['line 3', 'line 2', 'line 1'], getline(1, 3)) |
| 28 | + call assert_true(&modified) |
| 29 | + set nomodified |
| 30 | + |
| 31 | + 2,3move 0 |
| 32 | + call assert_equal(['line 2', 'line 1', 'line 3'], getline(1, 3)) |
| 33 | + call assert_true(&modified) |
| 34 | + set nomodified |
| 35 | + |
| 36 | + call assert_fails('1,2move 1', 'E134') |
| 37 | + call assert_fails('2,3move 2', 'E134') |
| 38 | + |
| 39 | + %bwipeout! |
| 40 | +endfunc |
0 commit comments