Skip to content

Commit 959d306

Browse files
authored
Merge pull request #82 from blueyed/diff
Improve test/run.vim
2 parents 81691a7 + bf91319 commit 959d306

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

test/run.vim

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
2-
31
let s:vimlparser = vimlparser#import()
42

53
let s:sdir = expand('<sfile>:p:h')
64

75
function! s:run()
6+
enew
7+
set buftype=nofile
88
let ng = 0
99
for vimfile in glob(s:sdir . '/test*.vim', 0, 1)
1010
let okfile = fnamemodify(vimfile, ':r') . '.ok'
@@ -25,7 +25,8 @@ function! s:run()
2525
catch
2626
call writefile([v:exception], outfile)
2727
endtry
28-
if system(printf('diff %s %s', shellescape(okfile), shellescape(outfile))) == ""
28+
let diff = system(printf('diff -u %s %s', shellescape(okfile), shellescape(outfile)))
29+
if empty(diff)
2930
let line = printf('%s => ok', fnamemodify(vimfile, ':.'))
3031
call append(line('$'), line)
3132
else
@@ -34,7 +35,7 @@ function! s:run()
3435
endif
3536
let line = printf('%s => ' . (skip ? 'skip' : 'ng'), fnamemodify(vimfile, ':.'))
3637
call append(line('$'), line)
37-
for line in readfile(outfile)
38+
for line in split(diff, '\n')
3839
call append(line('$'), ' ' . line)
3940
endfor
4041
endif

0 commit comments

Comments
 (0)