neovim 0.6.2 → 0.9.0.pre.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/docs.yml +36 -0
- data/.github/workflows/linter.yml +32 -0
- data/.github/workflows/tests.yml +62 -0
- data/.gitignore +5 -1
- data/.rubocop.yml +149 -0
- data/CHANGELOG.md +56 -0
- data/CODE_OF_CONDUCT.md +3 -3
- data/Gemfile +0 -11
- data/README.md +22 -23
- data/Rakefile +47 -15
- data/VimFlavor +1 -0
- data/exe/neovim-ruby-host +5 -0
- data/lib/neovim.rb +15 -6
- data/lib/neovim/api.rb +2 -1
- data/lib/neovim/buffer.rb +81 -53
- data/lib/neovim/client.rb +226 -41
- data/lib/neovim/client_info.rb +46 -0
- data/lib/neovim/connection.rb +73 -0
- data/lib/neovim/event_loop.rb +41 -37
- data/lib/neovim/executable.rb +1 -0
- data/lib/neovim/host.rb +50 -51
- data/lib/neovim/host/cli.rb +41 -0
- data/lib/neovim/host/loader.rb +1 -4
- data/lib/neovim/line_range.rb +16 -16
- data/lib/neovim/logging.rb +18 -18
- data/lib/neovim/message.rb +70 -0
- data/lib/neovim/plugin.rb +7 -5
- data/lib/neovim/plugin/dsl.rb +10 -4
- data/lib/neovim/plugin/handler.rb +8 -8
- data/lib/neovim/remote_object.rb +8 -5
- data/lib/neovim/ruby_provider.rb +52 -26
- data/lib/neovim/ruby_provider/buffer_ext.rb +1 -0
- data/lib/neovim/ruby_provider/object_ext.rb +5 -0
- data/lib/neovim/ruby_provider/vim.rb +19 -6
- data/lib/neovim/ruby_provider/window_ext.rb +1 -0
- data/lib/neovim/session.rb +45 -50
- data/lib/neovim/tabpage.rb +8 -15
- data/lib/neovim/version.rb +1 -1
- data/lib/neovim/window.rb +39 -36
- data/neovim.gemspec +11 -6
- data/script/ci/download_nvim.sh +40 -0
- data/script/{dump_api → dump_api.rb} +1 -1
- data/script/{generate_docs → generate_docs.rb} +6 -7
- data/script/{j2mp → j2mp.rb} +0 -0
- data/script/{mp2j → mp2j.rb} +0 -0
- data/script/run_acceptance.rb +39 -0
- data/spec/acceptance/client_info_spec.vim +42 -0
- data/spec/acceptance/rplugin_autocmd_spec.vim +20 -10
- data/spec/acceptance/rplugin_command_spec.vim +54 -56
- data/spec/acceptance/rplugin_function_spec.vim +28 -22
- data/spec/acceptance/ruby_spec.vim +52 -53
- data/spec/acceptance/rubydo_spec.vim +49 -52
- data/spec/acceptance/rubyeval_spec.vim +22 -0
- data/spec/acceptance/rubyfile/curbuf_ivar_get.rb +1 -1
- data/spec/acceptance/rubyfile/curbuf_ivar_set.rb +1 -1
- data/spec/acceptance/rubyfile/define_foo.rb +1 -1
- data/spec/acceptance/rubyfile/nested.rb +1 -1
- data/spec/acceptance/rubyfile/nested_inner.rb +1 -1
- data/spec/acceptance/rubyfile/set_pwd_after.rb +1 -1
- data/spec/acceptance/rubyfile/set_pwd_before.rb +1 -1
- data/spec/acceptance/rubyfile_spec.vim +60 -66
- data/spec/acceptance/runtime/init.vim +5 -4
- data/spec/acceptance/runtime/rplugin/ruby/autocmds.rb +7 -3
- data/spec/acceptance/runtime/rplugin/ruby/commands.rb +18 -17
- data/spec/acceptance/runtime/rplugin/ruby/functions.rb +9 -9
- data/spec/helper.rb +38 -9
- data/spec/neovim/api_spec.rb +2 -2
- data/spec/neovim/buffer_spec.rb +10 -6
- data/spec/neovim/client_info_spec.rb +77 -0
- data/spec/neovim/client_spec.rb +19 -12
- data/spec/neovim/connection_spec.rb +106 -0
- data/spec/neovim/current_spec.rb +13 -14
- data/spec/neovim/event_loop_spec.rb +48 -46
- data/spec/neovim/executable_spec.rb +2 -2
- data/spec/neovim/host/cli_spec.rb +94 -0
- data/spec/neovim/host/loader_spec.rb +18 -11
- data/spec/neovim/host_spec.rb +84 -92
- data/spec/neovim/line_range_spec.rb +17 -19
- data/spec/neovim/logging_spec.rb +3 -3
- data/spec/neovim/message_spec.rb +119 -0
- data/spec/neovim/plugin_spec.rb +34 -34
- data/spec/neovim/remote_object_spec.rb +1 -2
- data/spec/neovim/ruby_provider/buffer_ext_spec.rb +8 -9
- data/spec/neovim/ruby_provider/object_ext_spec.rb +10 -0
- data/spec/neovim/ruby_provider/vim_spec.rb +5 -5
- data/spec/neovim/ruby_provider/window_ext_spec.rb +12 -15
- data/spec/neovim/session_spec.rb +20 -47
- data/spec/neovim/window_spec.rb +1 -2
- data/spec/neovim_spec.rb +28 -51
- data/spec/support.rb +27 -1
- metadata +83 -48
- data/.coveralls.yml +0 -1
- data/.gitmodules +0 -3
- data/.rspec +0 -1
- data/.travis.yml +0 -23
- data/appveyor.yml +0 -21
- data/bin/neovim-ruby-host +0 -18
- data/lib/neovim/event_loop/connection.rb +0 -78
- data/lib/neovim/event_loop/message_builder.rb +0 -127
- data/lib/neovim/event_loop/serializer.rb +0 -37
- data/spec/acceptance/runtime/rplugin.vim +0 -37
- data/spec/acceptance/runtime/vader.vim/autoload/vader.vim +0 -348
- data/spec/acceptance/runtime/vader.vim/autoload/vader/assert.vim +0 -116
- data/spec/acceptance/runtime/vader.vim/autoload/vader/helper.vim +0 -43
- data/spec/acceptance/runtime/vader.vim/autoload/vader/parser.vim +0 -179
- data/spec/acceptance/runtime/vader.vim/autoload/vader/syntax.vim +0 -73
- data/spec/acceptance/runtime/vader.vim/autoload/vader/window.vim +0 -205
- data/spec/acceptance/runtime/vader.vim/plugin/vader.vim +0 -37
- data/spec/acceptance_spec.rb +0 -82
- data/spec/neovim/event_loop/connection_spec.rb +0 -89
- data/spec/neovim/event_loop/message_builder_spec.rb +0 -105
- data/spec/neovim/event_loop/serializer_spec.rb +0 -63
@@ -0,0 +1,40 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
set -eu
|
4
|
+
|
5
|
+
: ${RUNNER_OS:?} ${BUILD:?}
|
6
|
+
|
7
|
+
case "$BUILD" in
|
8
|
+
latest)
|
9
|
+
URL_PART="latest/download"
|
10
|
+
;;
|
11
|
+
nightly)
|
12
|
+
URL_PART="download/nightly"
|
13
|
+
;;
|
14
|
+
*)
|
15
|
+
echo "BUILD must be 'latest' or 'nightly'." >&2
|
16
|
+
exit 1
|
17
|
+
;;
|
18
|
+
esac
|
19
|
+
|
20
|
+
case "$(echo "$RUNNER_OS" | tr "[:upper:]" "[:lower:]")" in
|
21
|
+
macos)
|
22
|
+
wget -nv -P /tmp \
|
23
|
+
"https://github.com/neovim/neovim/releases/$URL_PART/nvim-macos.tar.gz"
|
24
|
+
tar -C /tmp -xzf /tmp/nvim-macos.tar.gz
|
25
|
+
mv /tmp/nvim-osx64 ./_nvim
|
26
|
+
;;
|
27
|
+
linux)
|
28
|
+
mkdir -p _nvim/bin
|
29
|
+
wget -nv -O _nvim/bin/nvim \
|
30
|
+
"https://github.com/neovim/neovim/releases/$URL_PART/nvim.appimage"
|
31
|
+
;;
|
32
|
+
*)
|
33
|
+
echo "Unrecognized \$RUNNER_OS" >&2
|
34
|
+
exit 1
|
35
|
+
;;
|
36
|
+
esac
|
37
|
+
|
38
|
+
chmod u+x _nvim/bin/nvim
|
39
|
+
|
40
|
+
_nvim/bin/nvim --version
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
$:.unshift File.expand_path("
|
3
|
+
$:.unshift File.expand_path("../lib", __dir__)
|
4
4
|
|
5
5
|
require "neovim"
|
6
6
|
require "pathname"
|
@@ -19,10 +19,6 @@ buffer_defs = Neovim::Buffer.instance_methods(false)
|
|
19
19
|
tabpage_defs = Neovim::Tabpage.instance_methods(false)
|
20
20
|
window_defs = Neovim::Window.instance_methods(false)
|
21
21
|
|
22
|
-
def add_method(docs, defs, method_name)
|
23
|
-
return if defs.include?(method_name.to_s)
|
24
|
-
end
|
25
|
-
|
26
22
|
session.request(:nvim_get_api_info)[1]["functions"].each do |func|
|
27
23
|
func_name = func["name"]
|
28
24
|
params = func["parameters"]
|
@@ -30,16 +26,18 @@ session.request(:nvim_get_api_info)[1]["functions"].each do |func|
|
|
30
26
|
case func_name
|
31
27
|
when /^nvim_buf_(.+)/
|
32
28
|
method_name = $1
|
29
|
+
params.shift
|
33
30
|
next if buffer_defs.include?(method_name.to_sym)
|
34
31
|
when /^nvim_win_(.+)/
|
35
32
|
method_name = $1
|
33
|
+
params.shift
|
36
34
|
next if window_defs.include?(method_name.to_sym)
|
37
35
|
when /^nvim_tabpage_(.+)/
|
38
36
|
method_name = $1
|
37
|
+
params.shift
|
39
38
|
next if tabpage_defs.include?(method_name.to_sym)
|
40
39
|
when /^nvim_(.+)/
|
41
40
|
method_name = $1
|
42
|
-
params.shift
|
43
41
|
next if nvim_defs.include?(method_name.to_sym)
|
44
42
|
else
|
45
43
|
next
|
@@ -72,7 +70,8 @@ session.request(:nvim_get_api_info)[1]["functions"].each do |func|
|
|
72
70
|
end
|
73
71
|
end
|
74
72
|
|
75
|
-
lib_dir = Pathname.new(File.expand_path("
|
73
|
+
lib_dir = Pathname.new(File.expand_path("../lib/neovim", __dir__))
|
74
|
+
|
76
75
|
{
|
77
76
|
"client.rb" => nvim_docs,
|
78
77
|
"buffer.rb" => buffer_docs,
|
data/script/{j2mp → j2mp.rb}
RENAMED
File without changes
|
data/script/{mp2j → mp2j.rb}
RENAMED
File without changes
|
@@ -0,0 +1,39 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "fileutils"
|
4
|
+
|
5
|
+
ENV.delete("VIM")
|
6
|
+
ENV.delete("VIMRUNTIME")
|
7
|
+
|
8
|
+
root = File.expand_path("..", __dir__)
|
9
|
+
acceptance_root = File.join(root, "spec/acceptance")
|
10
|
+
themis_rtp = File.join(acceptance_root, "runtime")
|
11
|
+
themis_home = File.join(themis_rtp, "flavors/thinca_vim-themis")
|
12
|
+
manifest = File.join(themis_rtp, "rplugin_manifest.vim")
|
13
|
+
vimrc = File.join(themis_rtp, "init.vim")
|
14
|
+
nvim = ENV.fetch("NVIM_EXECUTABLE", "nvim")
|
15
|
+
|
16
|
+
themis_exe = Gem.win_platform? ?
|
17
|
+
File.join(themis_home, "bin/themis.bat") :
|
18
|
+
File.join(themis_home, "bin/themis")
|
19
|
+
|
20
|
+
env = {
|
21
|
+
"NVIM_RPLUGIN_MANIFEST" => manifest,
|
22
|
+
"THEMIS_VIM" => nvim,
|
23
|
+
"THEMIS_HOME" => themis_home,
|
24
|
+
"THEMIS_ARGS" => "-e -s --headless -u #{vimrc}"
|
25
|
+
}
|
26
|
+
|
27
|
+
FileUtils.rm_f(manifest)
|
28
|
+
|
29
|
+
Dir.chdir(root) do
|
30
|
+
system(
|
31
|
+
env,
|
32
|
+
nvim,
|
33
|
+
"-e", "-s", "--headless",
|
34
|
+
"-u", vimrc,
|
35
|
+
"+UpdateRemotePlugins", "+qa!"
|
36
|
+
)
|
37
|
+
|
38
|
+
exec(env, themis_exe, *ARGV)
|
39
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
let s:suite = themis#suite("Client info")
|
2
|
+
let s:expect = themis#helper("expect")
|
3
|
+
|
4
|
+
function! s:suite.before_each() abort
|
5
|
+
call RPluginFunctionArgs(1, 2)
|
6
|
+
|
7
|
+
let s:client_chans = map(
|
8
|
+
\ filter(nvim_list_chans(), "has_key(v:val, 'client')"),
|
9
|
+
\ "v:val.client")
|
10
|
+
endfunction
|
11
|
+
|
12
|
+
function! s:suite.get_script_host_client_info() abort
|
13
|
+
let client_info = s:client_chans[1]
|
14
|
+
|
15
|
+
call s:expect(sort(keys(client_info))).to_equal(
|
16
|
+
\ ["attributes", "methods", "name", "type", "version"])
|
17
|
+
|
18
|
+
call s:expect(client_info.attributes).to_be_dict()
|
19
|
+
call s:expect(client_info.methods).to_equal({"specs": {"nargs": 1}, "poll": {}})
|
20
|
+
call s:expect(client_info.name).to_equal("ruby-script-host")
|
21
|
+
call s:expect(client_info.type).to_equal("host")
|
22
|
+
|
23
|
+
call s:expect(client_info.version.major).to_be_number()
|
24
|
+
call s:expect(client_info.version.minor).to_be_number()
|
25
|
+
call s:expect(client_info.version.patch).to_be_number()
|
26
|
+
endfunction
|
27
|
+
|
28
|
+
function! s:suite.get_rplugin_client_info() abort
|
29
|
+
let client_info = s:client_chans[0]
|
30
|
+
|
31
|
+
call s:expect(sort(keys(client_info))).to_equal(
|
32
|
+
\ ["attributes", "methods", "name", "type", "version"])
|
33
|
+
|
34
|
+
call s:expect(client_info.attributes).to_be_dict()
|
35
|
+
call s:expect(client_info.methods).to_equal({"specs": {"nargs": 1}, "poll": {}})
|
36
|
+
call s:expect(client_info.name).to_equal("ruby-rplugin-host")
|
37
|
+
call s:expect(client_info.type).to_equal("host")
|
38
|
+
|
39
|
+
call s:expect(client_info.version.major).to_be_number()
|
40
|
+
call s:expect(client_info.version.minor).to_be_number()
|
41
|
+
call s:expect(client_info.version.patch).to_be_number()
|
42
|
+
endfunction
|
@@ -1,18 +1,28 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
let s:suite = themis#suite("Remote plugin autocmd")
|
2
|
+
let s:expect = themis#helper("expect")
|
3
3
|
|
4
|
-
|
4
|
+
function! s:suite.has_nvim() abort
|
5
|
+
call s:expect(has("nvim")).to_equal(1)
|
6
|
+
endfunction
|
7
|
+
|
8
|
+
function! s:suite.triggers_for_matched_pattern() abort
|
5
9
|
silent split file.rb
|
6
|
-
|
7
|
-
|
10
|
+
call s:expect(b:rplugin_autocmd_BufEnter).to_equal(v:true)
|
11
|
+
endfunction
|
8
12
|
|
9
|
-
|
13
|
+
function! s:suite.doesnt_trigger_for_unmatched_pattern() abort
|
10
14
|
silent split file.py
|
11
|
-
|
12
|
-
|
15
|
+
call s:expect(exists('b:rplugin_autocmd_BufEnter')).to_equal(0)
|
16
|
+
endfunction
|
13
17
|
|
14
|
-
|
18
|
+
function! s:suite.supports_eval() abort
|
15
19
|
let g:to_eval = {'a': 42}
|
16
20
|
silent split file.c
|
21
|
+
call s:expect(g:rplugin_autocmd_BufEnter_eval).to_equal({'a': 42, 'b': 43})
|
22
|
+
endfunction
|
23
|
+
|
24
|
+
function! s:suite.supports_async() abort
|
25
|
+
silent split file.async
|
17
26
|
sleep 50m
|
18
|
-
|
27
|
+
call s:expect(g:rplugin_autocmd_BufEnter_async).to_equal(v:true)
|
28
|
+
endfunction
|
@@ -1,7 +1,17 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
let s:suite = themis#suite("Remote plugin command")
|
2
|
+
let s:expect = themis#helper("expect")
|
3
3
|
|
4
|
-
|
4
|
+
function! s:suite.before_each() abort
|
5
|
+
1,$delete
|
6
|
+
call append(0, ["one", "two", "three"])
|
7
|
+
normal gg
|
8
|
+
endfunction
|
9
|
+
|
10
|
+
function! s:suite.has_nvim() abort
|
11
|
+
call s:expect(has("nvim")).to_equal(1)
|
12
|
+
endfunction
|
13
|
+
|
14
|
+
function! s:suite.supports_arguments() abort
|
5
15
|
RPluginCommandNargs0
|
6
16
|
RPluginCommandNargs1 1
|
7
17
|
RPluginCommandNargsN
|
@@ -11,91 +21,79 @@ Execute (Call rplugin commands with arguments):
|
|
11
21
|
RPluginCommandNargsQ 1
|
12
22
|
RPluginCommandNargsP 1
|
13
23
|
RPluginCommandNargsP 1 2
|
14
|
-
sleep 100m
|
15
|
-
|
16
|
-
Then:
|
17
|
-
AssertEqual v:true, g:rplugin_command_nargs_0
|
18
|
-
AssertEqual "1", g:rplugin_command_nargs_1
|
19
|
-
AssertEqual ["1", "2"], g:rplugin_command_nargs_n
|
20
|
-
AssertEqual "1", g:rplugin_command_nargs_q
|
21
|
-
AssertEqual ["1", "2"], g:rplugin_command_nargs_p
|
22
24
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
25
|
+
call s:expect(g:rplugin_command_nargs_0).to_equal(v:true)
|
26
|
+
call s:expect(g:rplugin_command_nargs_1).to_equal("1")
|
27
|
+
call s:expect(g:rplugin_command_nargs_n).to_equal(["1", "2"])
|
28
|
+
call s:expect(g:rplugin_command_nargs_q).to_equal("1")
|
29
|
+
call s:expect(g:rplugin_command_nargs_p).to_equal(["1", "2"])
|
30
|
+
endfunction
|
27
31
|
|
28
|
-
|
32
|
+
function! s:suite.supports_line_range() abort
|
29
33
|
RPluginCommandRange
|
30
|
-
|
31
|
-
AssertEqual [1, 1], g:rplugin_command_range
|
34
|
+
call s:expect(g:rplugin_command_range).to_equal([1, 1])
|
32
35
|
|
33
36
|
1,2RPluginCommandRange
|
34
|
-
|
35
|
-
AssertEqual [1, 2], g:rplugin_command_range
|
37
|
+
call s:expect(g:rplugin_command_range).to_equal([1, 2])
|
36
38
|
|
37
39
|
%RPluginCommandRange
|
38
|
-
|
39
|
-
AssertEqual [1, 3], g:rplugin_command_range
|
40
|
+
call s:expect(g:rplugin_command_range).to_equal([1, 4])
|
40
41
|
|
41
42
|
RPluginCommandRangeP
|
42
|
-
|
43
|
-
AssertEqual [1, 3], g:rplugin_command_range_p
|
43
|
+
call s:expect(g:rplugin_command_range_p).to_equal([1, 4])
|
44
44
|
|
45
45
|
1,2RPluginCommandRangeP
|
46
|
-
|
47
|
-
AssertEqual [1, 2], g:rplugin_command_range_p
|
46
|
+
call s:expect(g:rplugin_command_range_p).to_equal([1, 2])
|
48
47
|
|
49
48
|
%RPluginCommandRangeP
|
50
|
-
|
51
|
-
AssertEqual [1, 3], g:rplugin_command_range_p
|
49
|
+
call s:expect(g:rplugin_command_range_p).to_equal([1, 4])
|
52
50
|
|
53
51
|
RPluginCommandRangeN
|
54
|
-
|
55
|
-
AssertEqual [1], g:rplugin_command_range_n
|
52
|
+
call s:expect(g:rplugin_command_range_n).to_equal([1])
|
56
53
|
|
57
54
|
2RPluginCommandRangeN
|
58
|
-
|
59
|
-
|
55
|
+
call s:expect(g:rplugin_command_range_n).to_equal([2])
|
56
|
+
endfunction
|
60
57
|
|
61
|
-
|
58
|
+
function! s:suite.supports_count() abort
|
62
59
|
RPluginCommandCountN
|
63
|
-
|
64
|
-
AssertEqual [1], g:rplugin_command_count_n
|
60
|
+
call s:expect(g:rplugin_command_count_n).to_equal([1])
|
65
61
|
|
66
62
|
2RPluginCommandCountN
|
67
|
-
|
68
|
-
|
63
|
+
call s:expect(g:rplugin_command_count_n).to_equal([2])
|
64
|
+
endfunction
|
69
65
|
|
70
|
-
|
66
|
+
function! s:suite.supports_bang() abort
|
71
67
|
RPluginCommandBang
|
72
|
-
|
73
|
-
AssertEqual 0, g:rplugin_command_bang
|
68
|
+
call s:expect(g:rplugin_command_bang).to_equal(0)
|
74
69
|
|
75
70
|
RPluginCommandBang!
|
76
|
-
|
77
|
-
|
71
|
+
call s:expect(g:rplugin_command_bang).to_equal(1)
|
72
|
+
endfunction
|
78
73
|
|
79
|
-
|
74
|
+
function! s:suite.supports_register() abort
|
80
75
|
RPluginCommandRegister a
|
81
|
-
|
82
|
-
|
76
|
+
call s:expect(g:rplugin_command_register).to_equal("a")
|
77
|
+
endfunction
|
83
78
|
|
84
|
-
|
79
|
+
function! s:suite.supports_completion() abort
|
85
80
|
RPluginCommandCompletion
|
86
|
-
|
87
|
-
|
81
|
+
call s:expect(g:rplugin_command_completion).to_equal("buffer")
|
82
|
+
endfunction
|
88
83
|
|
89
|
-
|
84
|
+
function! s:suite.supports_eval() abort
|
90
85
|
let g:to_eval = {'a': 42}
|
91
86
|
RPluginCommandEval
|
92
|
-
|
93
|
-
|
87
|
+
call s:expect(g:rplugin_command_eval).to_equal({'a': 42, 'b': 43})
|
88
|
+
endfunction
|
94
89
|
|
95
|
-
|
96
|
-
|
97
|
-
|
90
|
+
function! s:suite.supports_asynchronous_commands() abort
|
91
|
+
RPluginCommandAsync
|
92
|
+
sleep 50m
|
93
|
+
call s:expect(g:rplugin_command_async).to_equal(v:true)
|
94
|
+
endfunction
|
98
95
|
|
99
|
-
|
96
|
+
function! s:suite.supports_recursion() abort
|
100
97
|
RPluginCommandRecursive 0
|
101
|
-
|
98
|
+
call s:expect(g:rplugin_command_recursive).to_equal("10")
|
99
|
+
endfunction
|
@@ -1,29 +1,35 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
let s:suite = themis#suite("Remote plugin function")
|
2
|
+
let s:expect = themis#helper("expect")
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
function! s:suite.before_each() abort
|
5
|
+
1,$delete
|
6
|
+
call append(0, ["one", "two", "three"])
|
7
|
+
endfunction
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
three
|
9
|
+
function! s:suite.has_nvim() abort
|
10
|
+
call s:expect(has("nvim")).to_equal(1)
|
11
|
+
endfunction
|
13
12
|
|
14
|
-
|
15
|
-
1,
|
16
|
-
|
17
|
-
|
13
|
+
function! s:suite.supports_arguments() abort
|
14
|
+
call s:expect(RPluginFunctionArgs(1, 2)).to_equal([1, 2])
|
15
|
+
endfunction
|
16
|
+
|
17
|
+
function! s:suite.supports_line_range() abort
|
18
|
+
3,4call RPluginFunctionRange()
|
19
|
+
call s:expect(g:rplugin_function_range).to_equal([3, 4])
|
20
|
+
endfunction
|
18
21
|
|
19
|
-
|
22
|
+
function! s:suite.supports_eval() abort
|
20
23
|
let g:to_eval = {'a': 42}
|
21
|
-
call RPluginFunctionEval()
|
22
|
-
|
23
|
-
AssertEqual {'a': 42, 'b': 43}, g:rplugin_function_eval
|
24
|
+
call s:expect(RPluginFunctionEval()).to_equal({"a": 42, "b": 43})
|
25
|
+
endfunction
|
24
26
|
|
25
|
-
|
26
|
-
|
27
|
+
function! s:suite.supports_asynchronous_functions() abort
|
28
|
+
call RPluginFunctionAsync()
|
29
|
+
sleep 50m
|
30
|
+
call s:expect(g:rplugin_function_async).to_equal(v:true)
|
31
|
+
endfunction
|
27
32
|
|
28
|
-
|
29
|
-
|
33
|
+
function! s:suite.supports_recursion() abort
|
34
|
+
call s:expect(RPluginFunctionRecursive(0)).to_equal(10)
|
35
|
+
endfunction
|
@@ -1,92 +1,91 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
1
|
+
let s:suite = themis#suite(":ruby")
|
2
|
+
let s:expect = themis#helper("expect")
|
3
|
+
|
4
|
+
function! s:suite.before_each() abort
|
5
|
+
let s:pwd = getcwd()
|
6
|
+
1,$delete
|
7
|
+
call append(0, ["one", "two"])
|
8
|
+
unlet! s:var
|
9
|
+
endfunction
|
10
|
+
|
11
|
+
function! s:suite.after_each() abort
|
12
|
+
execute("cd " . s:pwd)
|
13
|
+
endfunction
|
14
|
+
|
15
|
+
function! s:suite.has_nvim() abort
|
16
|
+
call s:expect(has("nvim")).to_equal(1)
|
17
|
+
endfunction
|
18
|
+
|
19
|
+
function! s:suite.defines_a_ruby_method() abort
|
20
|
+
ruby def foo; Vim.command("let s:var = 1"); end
|
16
21
|
ruby foo
|
17
22
|
|
18
|
-
|
19
|
-
|
23
|
+
call s:expect(s:var).to_equal(1)
|
24
|
+
endfunction
|
20
25
|
|
21
|
-
|
26
|
+
function! s:suite.persists_curbuf_state() abort
|
22
27
|
ruby $curbuf.instance_variable_set(:@foo, 123)
|
23
|
-
ruby Vim.command("let
|
28
|
+
ruby Vim.command("let s:var = #{$curbuf.instance_variable_get(:@foo)}")
|
24
29
|
|
25
|
-
|
26
|
-
|
30
|
+
call s:expect(s:var).to_equal(123)
|
31
|
+
endfunction
|
27
32
|
|
28
|
-
|
33
|
+
function! s:suite.updates_working_directory() abort
|
29
34
|
cd /
|
30
|
-
ruby Vim.command("let
|
35
|
+
ruby Vim.command("let s:var = '#{Dir.pwd.sub(/^[A-Z]:/, "")}'")
|
31
36
|
cd -
|
32
37
|
|
33
|
-
|
34
|
-
|
35
|
-
AssertEqual "/", g:ruby_pwd
|
36
|
-
endif
|
38
|
+
call s:expect(s:var).to_equal("/")
|
39
|
+
endfunction
|
37
40
|
|
38
|
-
|
41
|
+
function! s:suite.updates_working_directory_implicitly() abort
|
39
42
|
split | lcd /
|
40
|
-
ruby Vim.command("let
|
43
|
+
ruby Vim.command("let s:var = ['#{Dir.pwd}']")
|
41
44
|
wincmd p
|
42
|
-
ruby Vim.command("
|
45
|
+
ruby Vim.command("call add(s:var, '#{Dir.pwd}')")
|
43
46
|
wincmd p | lcd -
|
44
47
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
endif
|
48
|
+
call s:expect(len(s:var)).to_equal(2)
|
49
|
+
call s:expect(s:var[0]).not.to_equal(s:var[1])
|
50
|
+
endfunction
|
49
51
|
|
50
|
-
|
51
|
-
ruby Vim.command("ruby Vim.command('let
|
52
|
+
function! s:suite.supports_nesting() abort
|
53
|
+
ruby Vim.command("ruby Vim.command('let s:var = 123')")
|
52
54
|
|
53
|
-
|
54
|
-
|
55
|
+
call s:expect(s:var).to_equal(123)
|
56
|
+
endfunction
|
55
57
|
|
56
|
-
|
58
|
+
function! s:suite.handles_standard_error() abort
|
57
59
|
try
|
58
60
|
ruby raise "BOOM"
|
59
61
|
throw "Nothing raised"
|
60
62
|
catch /BOOM/
|
61
63
|
endtry
|
62
64
|
|
63
|
-
|
65
|
+
call s:suite.defines_a_ruby_method()
|
66
|
+
endfunction
|
64
67
|
|
65
|
-
|
66
|
-
still works
|
67
|
-
two
|
68
|
-
|
69
|
-
Execute (Raise a Ruby syntax error):
|
68
|
+
function! s:suite.handles_syntax_error() abort
|
70
69
|
try
|
71
70
|
ruby puts[
|
72
71
|
throw "Nothing raised"
|
73
72
|
catch /SyntaxError/
|
74
73
|
endtry
|
75
74
|
|
76
|
-
|
77
|
-
|
78
|
-
Expect:
|
79
|
-
still works
|
80
|
-
two
|
75
|
+
call s:suite.defines_a_ruby_method()
|
76
|
+
endfunction
|
81
77
|
|
82
|
-
|
78
|
+
function! s:suite.exposes_Vim() abort
|
83
79
|
ruby expect(Vim).to eq(VIM)
|
84
80
|
ruby expect(Vim.strwidth("hi")).to eq(2)
|
81
|
+
endfunction
|
85
82
|
|
86
|
-
|
83
|
+
function! s:suite.exposes_Buffer() abort
|
87
84
|
ruby expect($curbuf).to be_a(Neovim::Buffer)
|
88
85
|
ruby expect(Vim::Buffer.current).to eq($curbuf)
|
86
|
+
endfunction
|
89
87
|
|
90
|
-
|
88
|
+
function! s:suite.exposes_Window() abort
|
91
89
|
ruby expect($curwin).to be_a(Neovim::Window)
|
92
90
|
ruby expect(Vim::Window.current).to eq($curwin)
|
91
|
+
endfunction
|