|
| 1 | +let s:testfile = expand('%') |
1 | 2 | let s:has_errors = 0
|
2 | 3 |
|
3 | 4 | try
|
4 | 5 | execute 'cd' fnamemodify(resolve(expand('<sfile>:p')), ':h')
|
5 |
| - execute 'source' 'plugin/strip_trailing_whitespace.vim' |
| 6 | + source plugin/strip_trailing_whitespace.vim |
6 | 7 |
|
7 |
| - let s:testfiles = glob('test/*.vim', 1, 1) |
8 |
| - for s:testfile in s:testfiles |
9 |
| - execute 'source' s:testfile |
10 |
| - |
11 |
| - let s:tests = map(split(execute('function /^Test_'), "\n"), {_, v -> matchstr(v, 'function \zs\k\+\ze()')}) |
12 |
| - for s:test_function in s:tests |
13 |
| - let v:errors = [] |
14 |
| - try |
15 |
| - echo 'Test' s:test_function |
16 |
| - execute 'call' s:test_function '()' |
17 |
| - catch |
18 |
| - call add(v:errors, "Uncaught exception in test: " .. v:exception .. " at " .. v:throwpoint) |
19 |
| - finally |
20 |
| - if !empty(v:errors) |
21 |
| - echo s:testfile .. ':1:Error' |
22 |
| - for s:error in v:errors |
23 |
| - echo s:error |
24 |
| - endfor |
25 |
| - let s:has_errors = 1 |
26 |
| - endif |
27 |
| - endtry |
28 |
| - endfor |
| 8 | + source % |
| 9 | + let s:tests = map(split(execute('function /^Test_'), "\n"), {_, v -> matchstr(v, 'function \zs\k\+\ze()')}) |
| 10 | + for s:test_function in s:tests |
| 11 | + let v:errors = [] |
| 12 | + echo 'Test' s:test_function |
| 13 | + try |
| 14 | + execute 'call' s:test_function '()' |
| 15 | + catch |
| 16 | + call add(v:errors, "Uncaught exception in test: " .. v:exception .. " at " .. v:throwpoint) |
| 17 | + finally |
| 18 | + if !empty(v:errors) |
| 19 | + echo s:testfile .. ':1:Error' |
| 20 | + for s:error in v:errors |
| 21 | + echo s:error |
| 22 | + endfor |
| 23 | + let s:has_errors = 1 |
| 24 | + endif |
| 25 | + endtry |
29 | 26 | endfor
|
30 | 27 | catch
|
31 | 28 | echo v:exception
|
|
0 commit comments