forked from VimPlug/emmet-vim
Fixes tests
This commit is contained in:
54
unittest.vim
54
unittest.vim
@@ -2,28 +2,28 @@
|
|||||||
let s:sfile = expand('<sfile>')
|
let s:sfile = expand('<sfile>')
|
||||||
|
|
||||||
function! s:reload(d)
|
function! s:reload(d)
|
||||||
exe "so" a:d."/plugin/emmet.vim"
|
exe 'so' a:d.'/plugin/emmet.vim'
|
||||||
for f in split(globpath(a:d, 'autoload/**/*.vim'), "\n")
|
for f in split(globpath(a:d, 'autoload/**/*.vim'), "\n")
|
||||||
silent! exe "so" f
|
silent! exe 'so' f
|
||||||
endfor
|
endfor
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:show_type(type)
|
function! s:show_type(type)
|
||||||
echohl Search | echon "[" a:type "]\n" | echohl None
|
echohl Search | echon '[' a:type "]\n" | echohl None
|
||||||
echo "\r"
|
echo "\r"
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:show_category(category)
|
function! s:show_category(category)
|
||||||
echohl MatchParen | echon "[" a:category "]\n" | echohl None
|
echohl MatchParen | echon '[' a:category "]\n" | echohl None
|
||||||
echo "\r"
|
echo "\r"
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:show_pass(pass)
|
function! s:show_pass(pass)
|
||||||
echohl Title | echo "pass".a:pass."\n" | echohl None
|
echohl Title | echo 'pass'.a:pass."\n" | echohl None
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:show_done()
|
function! s:show_done()
|
||||||
echohl IncSearch | echo "done" | echohl None
|
echohl IncSearch | echo 'done' | echohl None
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:escape(str)
|
function! s:escape(str)
|
||||||
@@ -36,43 +36,43 @@ endfunction
|
|||||||
function! s:show_title(no, title)
|
function! s:show_title(no, title)
|
||||||
let title = s:escape(a:title)
|
let title = s:escape(a:title)
|
||||||
let width = &columns - 23
|
let width = &columns - 23
|
||||||
echohl MoreMsg | echon "\rtesting #".printf("%03d", a:no)
|
echohl MoreMsg | echon "\rtesting #".printf('%03d', a:no)
|
||||||
echohl None | echon ": " . (len(title) < width ? (title.repeat(' ', width-len(title))) : strpart(title, 0, width)) . ' ... '
|
echohl None | echon ': ' . (len(title) < width ? (title.repeat(' ', width-len(title))) : strpart(title, 0, width)) . ' ... '
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:show_skip(no, title)
|
function! s:show_skip(no, title)
|
||||||
let title = s:escape(a:title)
|
let title = s:escape(a:title)
|
||||||
let width = &columns - 23
|
let width = &columns - 23
|
||||||
echohl WarningMsg | echon "\rskipped #".printf("%03d", a:no)
|
echohl WarningMsg | echon "\rskipped #".printf('%03d', a:no)
|
||||||
echohl None | echon ": " . (len(title) < width ? (title.repeat(' ', width-len(title))) : strpart(title, 0, width)) . ' ... '
|
echohl None | echon ': ' . (len(title) < width ? (title.repeat(' ', width-len(title))) : strpart(title, 0, width)) . ' ... '
|
||||||
echo ""
|
echo ''
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:show_ok()
|
function! s:show_ok()
|
||||||
echohl Title | echon "ok\n" | echohl None
|
echohl Title | echon "ok\n" | echohl None
|
||||||
echo ""
|
echo ''
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:show_ng(no, expect, got)
|
function! s:show_ng(no, expect, got)
|
||||||
echohl WarningMsg | echon "ng\n" | echohl None
|
echohl WarningMsg | echon "ng\n" | echohl None
|
||||||
echohl ErrorMsg | echo "failed test #".a:no | echohl None
|
echohl ErrorMsg | echo 'failed test #'.a:no | echohl None
|
||||||
set more
|
set more
|
||||||
echohl WarningMsg | echo printf("expect(%d):", len(a:expect)) | echohl None
|
echohl WarningMsg | echo printf('expect(%d):', len(a:expect)) | echohl None
|
||||||
echo join(split(a:expect, "\n", 1), "|\n")
|
echo join(split(a:expect, "\n", 1), "|\n")
|
||||||
echohl WarningMsg | echo printf("got(%d):", len(a:got)) | echohl None
|
echohl WarningMsg | echo printf('got(%d):', len(a:got)) | echohl None
|
||||||
echo join(split(a:got, "\n", 1), "|\n")
|
echo join(split(a:got, "\n", 1), "|\n")
|
||||||
let cs = split(a:expect, '\zs')
|
let cs = split(a:expect, '\zs')
|
||||||
for c in range(len(cs))
|
for c in range(len(cs))
|
||||||
if c < len(a:got)
|
if c < len(a:got)
|
||||||
if a:expect[c] != a:got[c]
|
if a:expect[c] != a:got[c]
|
||||||
echohl WarningMsg | echo "differ at:" | echohl None
|
echohl WarningMsg | echo 'differ at:' | echohl None
|
||||||
echo a:expect[c :-1]
|
echo a:expect[c :-1]
|
||||||
break
|
break
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
echo ""
|
echo ''
|
||||||
throw "stop"
|
throw 'stop'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:test(...)
|
function! s:test(...)
|
||||||
@@ -107,7 +107,7 @@ function! s:test(...)
|
|||||||
endfor
|
endfor
|
||||||
if stridx(query, '$$$$') != -1
|
if stridx(query, '$$$$') != -1
|
||||||
silent! 1new
|
silent! 1new
|
||||||
silent! exe "setlocal ft=".testgroup.type
|
silent! exe 'setlocal ft='.testgroup.type
|
||||||
silent! let key = matchstr(query, '.*\$\$\$\$\zs.*\ze\$\$\$\$')
|
silent! let key = matchstr(query, '.*\$\$\$\$\zs.*\ze\$\$\$\$')
|
||||||
if len(key) > 0
|
if len(key) > 0
|
||||||
exe printf('let key = "%s"', key)
|
exe printf('let key = "%s"', key)
|
||||||
@@ -159,7 +159,7 @@ function! s:do_tests(...)
|
|||||||
if exists('g:user_emmet_settings')
|
if exists('g:user_emmet_settings')
|
||||||
let s:old_user_emmet_settings = g:user_emmet_settings
|
let s:old_user_emmet_settings = g:user_emmet_settings
|
||||||
endif
|
endif
|
||||||
let g:user_emmet_settings = { 'indentation': "\t" }
|
let g:user_emmet_settings = {'variables': {'indentation': "\t", 'use_selection': 1}}
|
||||||
let oldmore = &more
|
let oldmore = &more
|
||||||
call s:reload(fnamemodify(s:sfile, ':h'))
|
call s:reload(fnamemodify(s:sfile, ':h'))
|
||||||
let &more = 0
|
let &more = 0
|
||||||
@@ -656,11 +656,11 @@ finish
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
'query': "{bg+$$$$}",
|
'query': "{bg+$$$$}",
|
||||||
'result': "{background: #FFF url($$$$) 0 0 no-repeat;}",
|
'result': "{background: $$$$#fff url() 0 0 no-repeat;}",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'query': "{bg+!$$$$}",
|
'query': "{bg+!$$$$}",
|
||||||
'result': "{background: #FFF url($$$$) 0 0 no-repeat !important;}",
|
'result': "{background: $$$$#fff url() 0 0 no-repeat !important;}",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'query': "{m$$$$}",
|
'query': "{m$$$$}",
|
||||||
@@ -712,11 +712,11 @@ finish
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
'query': "{(bg+)+c$$$$}",
|
'query': "{(bg+)+c$$$$}",
|
||||||
'result': "{background: #FFF url($$$$) 0 0 no-repeat;\ncolor: #000;}",
|
'result': "{background: $$$$#fff url() 0 0 no-repeat;\ncolor: #000;}",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'query': "{m0+bgi+bg++p0$$$$}",
|
'query': "{m0+bgi+bg++p0$$$$}",
|
||||||
'result': "{margin: 0;\nbackground-image: url($$$$);\nbackground: #FFF url() 0 0 no-repeat;\npadding: 0;}",
|
'result': "{margin: 0;\nbackground-image: url($$$$);\nbackground: #fff url() 0 0 no-repeat;\npadding: 0;}",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'query': "{borle$$$$}",
|
'query': "{borle$$$$}",
|
||||||
@@ -920,11 +920,11 @@ finish
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
'query': "{bg+$$$$}",
|
'query': "{bg+$$$$}",
|
||||||
'result': "{background: #FFF url($$$$) 0 0 no-repeat;}",
|
'result': "{background: $$$$#fff url() 0 0 no-repeat;}",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'query': "{bg+!$$$$}",
|
'query': "{bg+!$$$$}",
|
||||||
'result': "{background: #FFF url($$$$) 0 0 no-repeat !important;}",
|
'result': "{background: $$$$#fff url() 0 0 no-repeat !important;}",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'query': "{m$$$$}",
|
'query': "{m$$$$}",
|
||||||
@@ -976,7 +976,7 @@ finish
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
'query': "{(bg+)+c$$$$}",
|
'query': "{(bg+)+c$$$$}",
|
||||||
'result': "{background: #FFF url($$$$) 0 0 no-repeat;\ncolor: #000;}",
|
'result': "{background: $$$$#fff url() 0 0 no-repeat;\ncolor: #000;}",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user