Bram Moolenaar | cf0213e | 2015-06-19 15:45:29 +0200 | [diff] [blame] | 1 | Tests for ruby interface. vim: set ft=vim : |
| 2 | |
| 3 | STARTTEST |
| 4 | :so small.vim |
| 5 | :set nocompatible viminfo+=nviminfo |
| 6 | :if !has('ruby') | e! test.ok | wq! test.out | endif |
| 7 | :" change buffer contents |
| 8 | :ruby VIM.command("normal /^1\n") |
| 9 | :ruby $curbuf.line = "1 changed line 1" |
| 10 | :" evaluate a List |
| 11 | :ruby VIM.command("normal /^2\n") |
| 12 | :let l = ["abc", "def"] |
| 13 | :ruby << EOF |
| 14 | curline = $curbuf.line_number |
| 15 | l = VIM.evaluate("l"); |
| 16 | $curbuf.append(curline, l.join("\n")) |
| 17 | EOF |
| 18 | :normal j |
| 19 | :.rubydo $_ = $_.gsub(/\n/, '/') |
| 20 | :?^1?,$w! test.out |
| 21 | :qa! |
| 22 | ENDTEST |
| 23 | |
| 24 | 1 line 1 |
| 25 | 2 line 2 |