From e8e9877cfc2f5335695ecb560445d17abfe0e183 Mon Sep 17 00:00:00 2001 From: mattn Date: Thu, 22 Aug 2013 20:32:01 +0900 Subject: [PATCH] Fixes tests --- unittest.vim | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/unittest.vim b/unittest.vim index e779e36..aecda6a 100644 --- a/unittest.vim +++ b/unittest.vim @@ -91,11 +91,19 @@ function! s:test(...) for n in range(len(tests)) if len(index) > 0 && n != index | continue | endif let query = tests[n].query + let options = has_key(tests[n], 'options') ? tests[n].options : {} let result = tests[n].result if has_key(tests[n], 'skip') && tests[n].skip != 0 call s:show_skip(n+1, query) continue endif + let oldoptions = {} + for opt in keys(options) + if has_key(g:, opt) + let oldoptions[opt] = get(g:, opt) + endif + let g:[opt] = options[opt] + endfor if stridx(query, '$$$$') != -1 silent! 1new silent! exe "setlocal ft=".testgroup.type @@ -119,6 +127,13 @@ function! s:test(...) call s:show_title(n+1, query) unlet! res | let res = emmet#ExpandWord(query, testgroup.type, 0) endif + for opt in keys(options) + if has_key(oldoptions, opt) + let g:[opt] = oldoptions[opt] + else + call remove(g:, opt) + endif + endfor if stridx(result, '$$$$') != -1 if res ==# result call s:show_ok() @@ -404,7 +419,7 @@ finish }, { 'query': "link:css", - 'result': "\n", + 'result': "\n", }, { 'query': "a[title=\"Hello', world\" rel]", @@ -460,7 +475,7 @@ finish }, { 'query': "(div>(label+input))+div", - 'result': "
\n\t\n\t\n
\n
\n", + 'result': "
\n\t\n\t\n
\n
\n", }, { 'query': "test1\ntest2\ntest3$$$$\\ggVG\\,ul>li>span*>a\\$$$$", @@ -468,7 +483,7 @@ finish }, { 'query': "test1\ntest2\ntest3$$$$\\ggVG\\,input[type=input value=$#]*\\$$$$", - 'result': "\n\n", + 'result': "\n\n", }, { 'query': "div#id-$*5>div#id2-$", @@ -535,15 +550,15 @@ finish 'tests': [ { 'query': "img[src=http://mattn.kaoriya.net/images/logo.png]$$$$\\,\\i$$$$", - 'result': "\"\"", + 'result': "\"\"", }, { 'query': "img[src=/logo.png]$$$$\\,\\i$$$$", - 'result': "\"\"", + 'result': "\"\"", }, { 'query': "img[src=http://mattn.kaoriya.net/images/logo.png width=foo height=bar]$$$$\\,\\i$$$$", - 'result': "\"\"", + 'result': "\"\"", }, ], },