neovim 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +3 -1
- data/.rubocop.yml +118 -0
- data/.travis.yml +1 -1
- data/CHANGELOG.md +5 -0
- data/Rakefile +29 -16
- data/VimFlavor +1 -0
- data/appveyor.yml +2 -0
- data/lib/neovim/api.rb +2 -1
- data/lib/neovim/buffer.rb +7 -15
- data/lib/neovim/client.rb +3 -3
- data/lib/neovim/connection.rb +6 -7
- data/lib/neovim/event_loop.rb +3 -3
- data/lib/neovim/executable.rb +1 -0
- data/lib/neovim/host.rb +12 -12
- data/lib/neovim/line_range.rb +16 -16
- data/lib/neovim/logging.rb +14 -14
- data/lib/neovim/message.rb +7 -7
- data/lib/neovim/plugin/dsl.rb +4 -4
- data/lib/neovim/plugin/handler.rb +3 -3
- data/lib/neovim/remote_object.rb +3 -3
- data/lib/neovim/ruby_provider.rb +11 -15
- data/lib/neovim/ruby_provider/buffer_ext.rb +1 -0
- data/lib/neovim/ruby_provider/vim.rb +14 -2
- data/lib/neovim/ruby_provider/window_ext.rb +1 -0
- data/lib/neovim/session.rb +7 -10
- data/lib/neovim/version.rb +1 -1
- data/lib/neovim/window.rb +3 -3
- data/neovim.gemspec +5 -4
- data/script/{dump_api → dump_api.rb} +0 -0
- data/script/{generate_docs → generate_docs.rb} +0 -0
- data/script/{j2mp → j2mp.rb} +0 -0
- data/script/{mp2j → mp2j.rb} +0 -0
- data/script/run_acceptance.rb +35 -0
- data/script/validate_docs.rb +29 -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 +40 -48
- data/spec/acceptance/rubydo_spec.vim +40 -52
- data/spec/acceptance/rubyfile/nested.rb +1 -1
- data/spec/acceptance/rubyfile_spec.vim +57 -63
- data/spec/acceptance/runtime/init.vim +4 -3
- data/spec/acceptance/runtime/rplugin/ruby/autocmds.rb +6 -2
- data/spec/acceptance/runtime/rplugin/ruby/commands.rb +17 -16
- data/spec/acceptance/runtime/rplugin/ruby/functions.rb +8 -8
- data/spec/helper.rb +2 -2
- data/spec/neovim/api_spec.rb +1 -1
- data/spec/neovim/client_spec.rb +10 -10
- data/spec/neovim/connection_spec.rb +5 -6
- data/spec/neovim/current_spec.rb +12 -12
- data/spec/neovim/executable_spec.rb +2 -2
- data/spec/neovim/host/loader_spec.rb +2 -2
- data/spec/neovim/host_spec.rb +7 -7
- data/spec/neovim/line_range_spec.rb +16 -16
- data/spec/neovim/logging_spec.rb +7 -7
- data/spec/neovim/plugin_spec.rb +6 -6
- data/spec/neovim/ruby_provider/buffer_ext_spec.rb +2 -2
- data/spec/neovim/ruby_provider/vim_spec.rb +4 -4
- data/spec/neovim/ruby_provider/window_ext_spec.rb +8 -8
- data/spec/neovim/session_spec.rb +8 -8
- data/spec/neovim/window_spec.rb +0 -1
- metadata +41 -27
- data/.gitmodules +0 -3
- data/.rspec +0 -1
- 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 -85
data/spec/neovim/window_spec.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: neovim
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Genco
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-03-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: msgpack
|
@@ -53,7 +53,7 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: coveralls
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
@@ -95,7 +95,7 @@ dependencies:
|
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: rake
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - ">="
|
@@ -122,6 +122,34 @@ dependencies:
|
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '3.0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rubocop
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - '='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 0.52.1
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - '='
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 0.52.1
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: vim-flavor
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - '='
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: 2.2.2
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - '='
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 2.2.2
|
125
153
|
description:
|
126
154
|
email:
|
127
155
|
- alexgenco@gmail.com
|
@@ -132,8 +160,7 @@ extra_rdoc_files: []
|
|
132
160
|
files:
|
133
161
|
- ".coveralls.yml"
|
134
162
|
- ".gitignore"
|
135
|
-
- ".
|
136
|
-
- ".rspec"
|
163
|
+
- ".rubocop.yml"
|
137
164
|
- ".travis.yml"
|
138
165
|
- CHANGELOG.md
|
139
166
|
- CODE_OF_CONDUCT.md
|
@@ -141,6 +168,7 @@ files:
|
|
141
168
|
- LICENSE.txt
|
142
169
|
- README.md
|
143
170
|
- Rakefile
|
171
|
+
- VimFlavor
|
144
172
|
- appveyor.yml
|
145
173
|
- bin/neovim-ruby-host
|
146
174
|
- lib/neovim.rb
|
@@ -169,10 +197,12 @@ files:
|
|
169
197
|
- lib/neovim/version.rb
|
170
198
|
- lib/neovim/window.rb
|
171
199
|
- neovim.gemspec
|
172
|
-
- script/dump_api
|
173
|
-
- script/generate_docs
|
174
|
-
- script/j2mp
|
175
|
-
- script/mp2j
|
200
|
+
- script/dump_api.rb
|
201
|
+
- script/generate_docs.rb
|
202
|
+
- script/j2mp.rb
|
203
|
+
- script/mp2j.rb
|
204
|
+
- script/run_acceptance.rb
|
205
|
+
- script/validate_docs.rb
|
176
206
|
- spec/acceptance/rplugin_autocmd_spec.vim
|
177
207
|
- spec/acceptance/rplugin_command_spec.vim
|
178
208
|
- spec/acceptance/rplugin_function_spec.vim
|
@@ -194,14 +224,6 @@ files:
|
|
194
224
|
- spec/acceptance/runtime/rplugin/ruby/autocmds.rb
|
195
225
|
- spec/acceptance/runtime/rplugin/ruby/commands.rb
|
196
226
|
- spec/acceptance/runtime/rplugin/ruby/functions.rb
|
197
|
-
- spec/acceptance/runtime/vader.vim/autoload/vader.vim
|
198
|
-
- spec/acceptance/runtime/vader.vim/autoload/vader/assert.vim
|
199
|
-
- spec/acceptance/runtime/vader.vim/autoload/vader/helper.vim
|
200
|
-
- spec/acceptance/runtime/vader.vim/autoload/vader/parser.vim
|
201
|
-
- spec/acceptance/runtime/vader.vim/autoload/vader/syntax.vim
|
202
|
-
- spec/acceptance/runtime/vader.vim/autoload/vader/window.vim
|
203
|
-
- spec/acceptance/runtime/vader.vim/plugin/vader.vim
|
204
|
-
- spec/acceptance_spec.rb
|
205
227
|
- spec/helper.rb
|
206
228
|
- spec/neovim/api_spec.rb
|
207
229
|
- spec/neovim/buffer_spec.rb
|
@@ -244,7 +266,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
244
266
|
version: '0'
|
245
267
|
requirements: []
|
246
268
|
rubyforge_project:
|
247
|
-
rubygems_version: 2.
|
269
|
+
rubygems_version: 2.6.13
|
248
270
|
signing_key:
|
249
271
|
specification_version: 4
|
250
272
|
summary: A Ruby client for Neovim
|
@@ -270,14 +292,6 @@ test_files:
|
|
270
292
|
- spec/acceptance/runtime/rplugin/ruby/autocmds.rb
|
271
293
|
- spec/acceptance/runtime/rplugin/ruby/commands.rb
|
272
294
|
- spec/acceptance/runtime/rplugin/ruby/functions.rb
|
273
|
-
- spec/acceptance/runtime/vader.vim/autoload/vader.vim
|
274
|
-
- spec/acceptance/runtime/vader.vim/autoload/vader/assert.vim
|
275
|
-
- spec/acceptance/runtime/vader.vim/autoload/vader/helper.vim
|
276
|
-
- spec/acceptance/runtime/vader.vim/autoload/vader/parser.vim
|
277
|
-
- spec/acceptance/runtime/vader.vim/autoload/vader/syntax.vim
|
278
|
-
- spec/acceptance/runtime/vader.vim/autoload/vader/window.vim
|
279
|
-
- spec/acceptance/runtime/vader.vim/plugin/vader.vim
|
280
|
-
- spec/acceptance_spec.rb
|
281
295
|
- spec/helper.rb
|
282
296
|
- spec/neovim/api_spec.rb
|
283
297
|
- spec/neovim/buffer_spec.rb
|
data/.gitmodules
DELETED
data/.rspec
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
--exclude-pattern 'spec/integration/**/*'
|
@@ -1,348 +0,0 @@
|
|
1
|
-
" Copyright (c) 2015 Junegunn Choi
|
2
|
-
"
|
3
|
-
" MIT License
|
4
|
-
"
|
5
|
-
" Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
" a copy of this software and associated documentation files (the
|
7
|
-
" "Software"), to deal in the Software without restriction, including
|
8
|
-
" without limitation the rights to use, copy, modify, merge, publish,
|
9
|
-
" distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
-
" permit persons to whom the Software is furnished to do so, subject to
|
11
|
-
" the following conditions:
|
12
|
-
"
|
13
|
-
" The above copyright notice and this permission notice shall be
|
14
|
-
" included in all copies or substantial portions of the Software.
|
15
|
-
"
|
16
|
-
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
-
" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
-
" NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
-
" LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
-
" OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
" WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
23
|
-
|
24
|
-
let s:register = {}
|
25
|
-
let s:register_undefined = []
|
26
|
-
let s:indent = 2
|
27
|
-
|
28
|
-
function! vader#run(bang, ...) range
|
29
|
-
let s:error_line = 0
|
30
|
-
|
31
|
-
if a:lastline - a:firstline > 0
|
32
|
-
if a:0 > 1
|
33
|
-
echoerr "You can't apply range on multiple files"
|
34
|
-
return
|
35
|
-
endif
|
36
|
-
let [line1, line2] = [a:firstline, a:lastline]
|
37
|
-
else
|
38
|
-
let [line1, line2] = [1, 0]
|
39
|
-
endif
|
40
|
-
|
41
|
-
let options = { 'exitfirst': index(a:000, '-x') >= 0 }
|
42
|
-
let patterns = filter(copy(a:000), "v:val !=# '-x'")
|
43
|
-
if empty(patterns)
|
44
|
-
let patterns = [expand('%')]
|
45
|
-
endif
|
46
|
-
|
47
|
-
call vader#assert#reset()
|
48
|
-
call s:prepare()
|
49
|
-
try
|
50
|
-
let all_cases = []
|
51
|
-
let qfl = []
|
52
|
-
let st = reltime()
|
53
|
-
let [success, pending, total] = [0, 0, 0]
|
54
|
-
|
55
|
-
for gl in patterns
|
56
|
-
if filereadable(gl)
|
57
|
-
let files = [gl]
|
58
|
-
else
|
59
|
-
let files = filter(split(glob(gl), "\n"),
|
60
|
-
\ "fnamemodify(v:val, ':e') ==# 'vader'")
|
61
|
-
endif
|
62
|
-
for fn in files
|
63
|
-
let afn = fnamemodify(fn, ':p')
|
64
|
-
let cases = vader#parser#parse(afn, line1, line2)
|
65
|
-
call add(all_cases, [afn, cases])
|
66
|
-
let total += len(cases)
|
67
|
-
endfor
|
68
|
-
endfor
|
69
|
-
if empty(all_cases)
|
70
|
-
throw 'Vader: no tests found for patterns ('.join(patterns).')'
|
71
|
-
endif
|
72
|
-
|
73
|
-
call vader#window#open()
|
74
|
-
call vader#window#append(
|
75
|
-
\ printf("Starting Vader: %d suite(s), %d case(s)", len(all_cases), total), 0)
|
76
|
-
|
77
|
-
for pair in all_cases
|
78
|
-
let [fn, case] = pair
|
79
|
-
let [cs, cp, ct, lqfl] = s:run(fn, case, options)
|
80
|
-
let success += cs
|
81
|
-
let pending += cp
|
82
|
-
call extend(qfl, lqfl)
|
83
|
-
call vader#window#append(
|
84
|
-
\ printf('Success/Total: %s/%s%s',
|
85
|
-
\ cs, ct, cp > 0 ? (' ('.cp.' pending)') : ''),
|
86
|
-
\ 1)
|
87
|
-
endfor
|
88
|
-
|
89
|
-
let stats = vader#assert#stat()
|
90
|
-
call vader#window#append(printf('Success/Total: %s/%s (%sassertions: %d/%d)',
|
91
|
-
\ success, total, (pending > 0 ? pending . ' pending, ' : ''),
|
92
|
-
\ stats[0], stats[1]), 0)
|
93
|
-
call vader#window#append('Elapsed time: '.
|
94
|
-
\ substitute(reltimestr(reltime(st)), '^\s*', '', '') .' sec.', 0)
|
95
|
-
call vader#window#cleanup()
|
96
|
-
|
97
|
-
let g:vader_report = join(getline(1, '$'), "\n")
|
98
|
-
let g:vader_errors = qfl
|
99
|
-
call setqflist(qfl)
|
100
|
-
|
101
|
-
if a:bang
|
102
|
-
redir => ver
|
103
|
-
silent version
|
104
|
-
redir END
|
105
|
-
|
106
|
-
call s:print_stderr(ver . "\n\n" . g:vader_report)
|
107
|
-
if success + pending == total
|
108
|
-
qall!
|
109
|
-
else
|
110
|
-
cq
|
111
|
-
endif
|
112
|
-
elseif !empty(qfl)
|
113
|
-
call vader#window#copen()
|
114
|
-
endif
|
115
|
-
catch
|
116
|
-
let error = 'Vader error: '.v:exception.' (in '.v:throwpoint.')'
|
117
|
-
if a:bang
|
118
|
-
call s:print_stderr(error)
|
119
|
-
cq
|
120
|
-
else
|
121
|
-
echoerr error
|
122
|
-
endif
|
123
|
-
finally
|
124
|
-
call s:cleanup()
|
125
|
-
endtry
|
126
|
-
endfunction
|
127
|
-
|
128
|
-
function! s:print_stderr(output)
|
129
|
-
let lines = split(a:output, '\n')
|
130
|
-
if filewritable($VADER_OUTPUT_FILE)
|
131
|
-
call writefile(lines, $VADER_OUTPUT_FILE, 'a')
|
132
|
-
else
|
133
|
-
let tmp = tempname()
|
134
|
-
call writefile(lines, tmp)
|
135
|
-
execute 'silent !cat '.tmp.' 1>&2'
|
136
|
-
call delete(tmp)
|
137
|
-
endif
|
138
|
-
endfunction
|
139
|
-
|
140
|
-
function! s:split_args(arg)
|
141
|
-
let varnames = split(a:arg, ',')
|
142
|
-
let names = []
|
143
|
-
for varname in varnames
|
144
|
-
let name = substitute(varname, '^\s*\(.*\)\s*$', '\1', '')
|
145
|
-
let name = substitute(name, '^''\(.*\)''$', '\1', '')
|
146
|
-
let name = substitute(name, '^"\(.*\)"$', '\1', '')
|
147
|
-
call add(names, name)
|
148
|
-
endfor
|
149
|
-
return names
|
150
|
-
endfunction
|
151
|
-
|
152
|
-
function! vader#log(msg)
|
153
|
-
let msg = type(a:msg) == 1 ? a:msg : string(a:msg)
|
154
|
-
call vader#window#append('> ' . msg, s:indent)
|
155
|
-
endfunction
|
156
|
-
|
157
|
-
function! vader#save(args)
|
158
|
-
for varname in s:split_args(a:args)
|
159
|
-
if exists(varname)
|
160
|
-
let s:register[varname] = eval(varname)
|
161
|
-
else
|
162
|
-
let s:register_undefined += [varname]
|
163
|
-
endif
|
164
|
-
endfor
|
165
|
-
endfunction
|
166
|
-
|
167
|
-
function! vader#restore(args)
|
168
|
-
let varnames = s:split_args(a:args)
|
169
|
-
for varname in empty(varnames) ? keys(s:register) : varnames
|
170
|
-
if has_key(s:register, varname)
|
171
|
-
execute printf("let %s = s:register['%s']", varname, varname)
|
172
|
-
endif
|
173
|
-
endfor
|
174
|
-
let undefined = empty(varnames) ? s:register_undefined
|
175
|
-
\ : filter(copy(varnames), 'index(s:register_undefined, v:val) != -1')
|
176
|
-
for varname in undefined
|
177
|
-
if varname[0] ==# '$'
|
178
|
-
execute printf('let %s = ""', varname)
|
179
|
-
else
|
180
|
-
execute printf('unlet! %s', varname)
|
181
|
-
endif
|
182
|
-
endfor
|
183
|
-
endfunction
|
184
|
-
|
185
|
-
function! s:prepare()
|
186
|
-
command! -nargs=+ Log :call vader#log(<args>)
|
187
|
-
command! -nargs=+ Save :call vader#save(<q-args>)
|
188
|
-
command! -nargs=* Restore :call vader#restore(<q-args>)
|
189
|
-
command! -nargs=+ Assert :call vader#assert#true(<args>)
|
190
|
-
command! -nargs=+ AssertEqual :call vader#assert#equal(<args>)
|
191
|
-
command! -nargs=+ AssertNotEqual :call vader#assert#not_equal(<args>)
|
192
|
-
command! -nargs=+ AssertThrows :call vader#assert#throws(<q-args>)
|
193
|
-
let g:SyntaxAt = function('vader#helper#syntax_at')
|
194
|
-
let g:SyntaxOf = function('vader#helper#syntax_of')
|
195
|
-
endfunction
|
196
|
-
|
197
|
-
function! s:cleanup()
|
198
|
-
let s:register = {}
|
199
|
-
let s:register_undefined = []
|
200
|
-
delcommand Log
|
201
|
-
delcommand Save
|
202
|
-
delcommand Restore
|
203
|
-
delcommand Assert
|
204
|
-
delcommand AssertEqual
|
205
|
-
delcommand AssertNotEqual
|
206
|
-
delcommand AssertThrows
|
207
|
-
unlet g:SyntaxAt
|
208
|
-
unlet g:SyntaxOf
|
209
|
-
endfunction
|
210
|
-
|
211
|
-
function! s:comment(case, label)
|
212
|
-
return get(a:case.comment, a:label, '')
|
213
|
-
endfunction
|
214
|
-
|
215
|
-
function! s:execute(prefix, type, block, lang_if)
|
216
|
-
try
|
217
|
-
call vader#window#execute(a:block, a:lang_if)
|
218
|
-
return 1
|
219
|
-
catch
|
220
|
-
call s:append(a:prefix, a:type, v:exception, 1)
|
221
|
-
call s:print_throwpoint()
|
222
|
-
return 0
|
223
|
-
endtry
|
224
|
-
endfunction
|
225
|
-
|
226
|
-
function! s:print_throwpoint()
|
227
|
-
if v:throwpoint !~ 'vader#assert'
|
228
|
-
Log v:throwpoint
|
229
|
-
endif
|
230
|
-
endfunction
|
231
|
-
|
232
|
-
function! s:run(filename, cases, options)
|
233
|
-
let given = []
|
234
|
-
let before = []
|
235
|
-
let after = []
|
236
|
-
let then = []
|
237
|
-
let comment = { 'given': '', 'before': '', 'after': '' }
|
238
|
-
let total = len(a:cases)
|
239
|
-
let just = len(string(total))
|
240
|
-
let cnt = 0
|
241
|
-
let pending = 0
|
242
|
-
let success = 0
|
243
|
-
let exitfirst = get(a:options, 'exitfirst', 0)
|
244
|
-
let qfl = []
|
245
|
-
let g:vader_file = a:filename
|
246
|
-
|
247
|
-
call vader#window#append("Starting Vader: ". a:filename, 1)
|
248
|
-
|
249
|
-
for case in a:cases
|
250
|
-
let cnt += 1
|
251
|
-
let ok = 1
|
252
|
-
let prefix = printf('(%'.just.'d/%'.just.'d)', cnt, total)
|
253
|
-
|
254
|
-
for label in ['given', 'before', 'after', 'then']
|
255
|
-
if has_key(case, label)
|
256
|
-
execute 'let '.label.' = case[label]'
|
257
|
-
let comment[label] = get(case.comment, label, '')
|
258
|
-
endif
|
259
|
-
endfor
|
260
|
-
|
261
|
-
if !empty(given)
|
262
|
-
call s:append(prefix, 'given', comment.given)
|
263
|
-
endif
|
264
|
-
call vader#window#prepare(given, get(case, 'type', ''))
|
265
|
-
|
266
|
-
if !empty(before)
|
267
|
-
let s:indent = 2
|
268
|
-
let ok = ok && s:execute(prefix, 'before', before, '')
|
269
|
-
endif
|
270
|
-
|
271
|
-
let s:indent = 3
|
272
|
-
if has_key(case, 'execute')
|
273
|
-
call s:append(prefix, 'execute', s:comment(case, 'execute'))
|
274
|
-
let ok = ok && s:execute(prefix, 'execute', case.execute, get(case, 'lang_if', ''))
|
275
|
-
elseif has_key(case, 'do')
|
276
|
-
call s:append(prefix, 'do', s:comment(case, 'do'))
|
277
|
-
try
|
278
|
-
call vader#window#replay(case.do)
|
279
|
-
catch
|
280
|
-
call s:append(prefix, 'do', v:exception, 1)
|
281
|
-
call s:print_throwpoint()
|
282
|
-
let ok = 0
|
283
|
-
endtry
|
284
|
-
endif
|
285
|
-
|
286
|
-
if has_key(case, 'then')
|
287
|
-
call s:append(prefix, 'then', s:comment(case, 'then'))
|
288
|
-
let ok = ok && s:execute(prefix, 'then', then, '')
|
289
|
-
endif
|
290
|
-
|
291
|
-
if has_key(case, 'expect')
|
292
|
-
let result = vader#window#result()
|
293
|
-
let match = case.expect ==# result
|
294
|
-
if match
|
295
|
-
call s:append(prefix, 'expect', s:comment(case, 'expect'))
|
296
|
-
else
|
297
|
-
let begin = s:append(prefix, 'expect', s:comment(case, 'expect'), 1)
|
298
|
-
let ok = 0
|
299
|
-
let data = { 'type': get(case, 'type', ''), 'got': result, 'expect': case.expect }
|
300
|
-
call vader#window#append('- Expected:', 3)
|
301
|
-
for line in case.expect
|
302
|
-
call vader#window#append(line, 5, 0)
|
303
|
-
endfor
|
304
|
-
let end = vader#window#append('- Got:', 3)
|
305
|
-
for line in result
|
306
|
-
let end = vader#window#append(line, 5, 0)
|
307
|
-
endfor
|
308
|
-
call vader#window#set_data(begin, end, data)
|
309
|
-
endif
|
310
|
-
endif
|
311
|
-
|
312
|
-
if !empty(after)
|
313
|
-
let s:indent = 2
|
314
|
-
let ok = s:execute(prefix, 'after', after, '') && ok
|
315
|
-
endif
|
316
|
-
|
317
|
-
if ok
|
318
|
-
let success += 1
|
319
|
-
else
|
320
|
-
let pending += case.pending
|
321
|
-
let description = join(filter([
|
322
|
-
\ comment.given,
|
323
|
-
\ get(case.comment, 'do', get(case.comment, 'execute', '')),
|
324
|
-
\ get(case.comment, 'then', ''),
|
325
|
-
\ get(case.comment, 'expect', '')], '!empty(v:val)'), ' / ') .
|
326
|
-
\ ' (#'.s:error_line.')'
|
327
|
-
call add(qfl, { 'type': 'E', 'filename': a:filename, 'lnum': case.lnum, 'text': description })
|
328
|
-
if exitfirst && !case.pending
|
329
|
-
call vader#window#append('Stopping after first failure.', 2)
|
330
|
-
break
|
331
|
-
endif
|
332
|
-
endif
|
333
|
-
endfor
|
334
|
-
|
335
|
-
unlet g:vader_file
|
336
|
-
return [success, pending, total, qfl]
|
337
|
-
endfunction
|
338
|
-
|
339
|
-
function! s:append(prefix, type, message, ...)
|
340
|
-
let error = get(a:, 1, 0)
|
341
|
-
let message = (error ? '(X) ' : '') . a:message
|
342
|
-
let line = vader#window#append(printf("%s [%7s] %s", a:prefix, toupper(a:type), message), 2)
|
343
|
-
if error
|
344
|
-
let s:error_line = line
|
345
|
-
endif
|
346
|
-
return line
|
347
|
-
endfunction
|
348
|
-
|