annotate src/testdir/test_ruby.vim @ 9742:0b0b9864c811 v7.4.2146

commit https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd Author: Bram Moolenaar <Bram@vim.org> Date: Tue Aug 2 22:36:02 2016 +0200 patch 7.4.2146 Problem: Not enough testing for popup menu. CTRL-E does not always work properly. Solution: Add more tests. When using CTRL-E check if the popup menu is visible. (Christian Brabandt)
author Christian Brabandt <cb@256bit.org>
date Tue, 02 Aug 2016 22:45:05 +0200
parents f23feeba7549
children 721af7a9b4b4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9338
f23feeba7549 commit https://github.com/vim/vim/commit/85babd6db65afb0eb06a7a9a0778d692248c5c2b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Tests for ruby interface
f23feeba7549 commit https://github.com/vim/vim/commit/85babd6db65afb0eb06a7a9a0778d692248c5c2b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
f23feeba7549 commit https://github.com/vim/vim/commit/85babd6db65afb0eb06a7a9a0778d692248c5c2b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 if !has('ruby')
f23feeba7549 commit https://github.com/vim/vim/commit/85babd6db65afb0eb06a7a9a0778d692248c5c2b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 finish
f23feeba7549 commit https://github.com/vim/vim/commit/85babd6db65afb0eb06a7a9a0778d692248c5c2b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 end
f23feeba7549 commit https://github.com/vim/vim/commit/85babd6db65afb0eb06a7a9a0778d692248c5c2b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6
f23feeba7549 commit https://github.com/vim/vim/commit/85babd6db65afb0eb06a7a9a0778d692248c5c2b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 func Test_ruby_change_buffer()
f23feeba7549 commit https://github.com/vim/vim/commit/85babd6db65afb0eb06a7a9a0778d692248c5c2b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 call setline(line('$'), ['1 line 1'])
f23feeba7549 commit https://github.com/vim/vim/commit/85babd6db65afb0eb06a7a9a0778d692248c5c2b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 ruby Vim.command("normal /^1\n")
f23feeba7549 commit https://github.com/vim/vim/commit/85babd6db65afb0eb06a7a9a0778d692248c5c2b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 ruby $curbuf.line = "1 changed line 1"
f23feeba7549 commit https://github.com/vim/vim/commit/85babd6db65afb0eb06a7a9a0778d692248c5c2b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 call assert_equal('1 changed line 1', getline('$'))
f23feeba7549 commit https://github.com/vim/vim/commit/85babd6db65afb0eb06a7a9a0778d692248c5c2b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 endfunc
f23feeba7549 commit https://github.com/vim/vim/commit/85babd6db65afb0eb06a7a9a0778d692248c5c2b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13
f23feeba7549 commit https://github.com/vim/vim/commit/85babd6db65afb0eb06a7a9a0778d692248c5c2b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 func Test_ruby_evaluate_list()
f23feeba7549 commit https://github.com/vim/vim/commit/85babd6db65afb0eb06a7a9a0778d692248c5c2b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 call setline(line('$'), ['2 line 2'])
f23feeba7549 commit https://github.com/vim/vim/commit/85babd6db65afb0eb06a7a9a0778d692248c5c2b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 ruby Vim.command("normal /^2\n")
f23feeba7549 commit https://github.com/vim/vim/commit/85babd6db65afb0eb06a7a9a0778d692248c5c2b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 let l = ["abc", "def"]
f23feeba7549 commit https://github.com/vim/vim/commit/85babd6db65afb0eb06a7a9a0778d692248c5c2b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 ruby << EOF
f23feeba7549 commit https://github.com/vim/vim/commit/85babd6db65afb0eb06a7a9a0778d692248c5c2b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 curline = $curbuf.line_number
f23feeba7549 commit https://github.com/vim/vim/commit/85babd6db65afb0eb06a7a9a0778d692248c5c2b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 l = Vim.evaluate("l");
f23feeba7549 commit https://github.com/vim/vim/commit/85babd6db65afb0eb06a7a9a0778d692248c5c2b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 $curbuf.append(curline, l.join("\n"))
f23feeba7549 commit https://github.com/vim/vim/commit/85babd6db65afb0eb06a7a9a0778d692248c5c2b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 EOF
f23feeba7549 commit https://github.com/vim/vim/commit/85babd6db65afb0eb06a7a9a0778d692248c5c2b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 normal j
f23feeba7549 commit https://github.com/vim/vim/commit/85babd6db65afb0eb06a7a9a0778d692248c5c2b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 .rubydo $_ = $_.gsub(/\n/, '/')
f23feeba7549 commit https://github.com/vim/vim/commit/85babd6db65afb0eb06a7a9a0778d692248c5c2b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 call assert_equal('abc/def', getline('$'))
f23feeba7549 commit https://github.com/vim/vim/commit/85babd6db65afb0eb06a7a9a0778d692248c5c2b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 endfunc
f23feeba7549 commit https://github.com/vim/vim/commit/85babd6db65afb0eb06a7a9a0778d692248c5c2b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27
f23feeba7549 commit https://github.com/vim/vim/commit/85babd6db65afb0eb06a7a9a0778d692248c5c2b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 func Test_ruby_evaluate_dict()
f23feeba7549 commit https://github.com/vim/vim/commit/85babd6db65afb0eb06a7a9a0778d692248c5c2b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 let d = {'a': 'foo', 'b': 123}
f23feeba7549 commit https://github.com/vim/vim/commit/85babd6db65afb0eb06a7a9a0778d692248c5c2b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 redir => l:out
f23feeba7549 commit https://github.com/vim/vim/commit/85babd6db65afb0eb06a7a9a0778d692248c5c2b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 ruby d = Vim.evaluate("d"); print d
f23feeba7549 commit https://github.com/vim/vim/commit/85babd6db65afb0eb06a7a9a0778d692248c5c2b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 redir END
f23feeba7549 commit https://github.com/vim/vim/commit/85babd6db65afb0eb06a7a9a0778d692248c5c2b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 call assert_equal(['{"a"=>"foo", "b"=>123}'], split(l:out, "\n"))
f23feeba7549 commit https://github.com/vim/vim/commit/85babd6db65afb0eb06a7a9a0778d692248c5c2b
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 endfunc