mirror of
https://github.com/mattn/emmet-vim.git
synced 2025-12-06 10:44:24 +08:00
start to fix formatting.
This commit is contained in:
64
unittest.vim
64
unittest.vim
@@ -2,7 +2,15 @@ if exists('g:user_zen_settings')
|
||||
let s:old_user_zen_settings = g:user_zen_settings
|
||||
unlet! g:user_zen_settings
|
||||
endif
|
||||
so plugin/zencoding.vim
|
||||
|
||||
function! s:reload(d)
|
||||
exe "so" a:d."/plugin/zencoding.vim"
|
||||
for f in split(globpath(a:d, 'autoload/**/*.vim'), "\n")
|
||||
exe "so" f
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
call s:reload(expand('<sfile>:h'))
|
||||
|
||||
function! s:show_category(category)
|
||||
echohl MatchParen | echon "[" a:category "]\n" | echohl None
|
||||
@@ -15,6 +23,13 @@ function! s:show_title(no, title)
|
||||
echohl None | echon ": " . (len(a:title) < width ? (a:title.repeat(' ', width-len(a:title))) : strpart(a:title, 0, width)) . ' ... '
|
||||
endfunction
|
||||
|
||||
function! s:show_skip(no, title)
|
||||
let width = &columns - 23
|
||||
echohl WarningMsg | echon "\rskipped #".printf("%03d", a:no)
|
||||
echohl None | echon ": " . (len(a:title) < width ? (a:title.repeat(' ', width-len(a:title))) : strpart(a:title, 0, width)) . ' ... '
|
||||
echo ""
|
||||
endfunction
|
||||
|
||||
function! s:show_ok()
|
||||
echohl Title | echon "ok\n" | echohl None
|
||||
echo ""
|
||||
@@ -24,13 +39,16 @@ function! s:show_ng(no, expect, got)
|
||||
echohl WarningMsg | echon "ng\n" | echohl None
|
||||
echohl ErrorMsg | echo "failed test #".a:no | echohl None
|
||||
set more
|
||||
echo printf(" expect(%d):%s", len(a:expect), a:expect)
|
||||
echo printf(" got(%d):%s", len(a:got), a:got)
|
||||
echohl WarningMsg | echo printf("expect(%d):", len(a:expect)) | echohl None
|
||||
echo join(split(a:expect, "\n", 1), "|\n")
|
||||
echohl WarningMsg | echo printf("got(%d):", len(a:got)) | echohl None
|
||||
echo join(split(a:got, "\n", 1), "|\n")
|
||||
let cs = split(a:expect, '\zs')
|
||||
for c in range(len(cs))
|
||||
if c < len(a:got)
|
||||
if a:expect[c] != a:got[c]
|
||||
echo printf(" differ at:%s", a:expect[c :-1])
|
||||
echohl WarningMsg | echo "differ at:" | echohl None
|
||||
echo a:expect[c :-1]
|
||||
break
|
||||
endif
|
||||
endif
|
||||
@@ -51,6 +69,10 @@ function! s:testExpandAbbr()
|
||||
let name = tests[n].name
|
||||
let query = tests[n].query
|
||||
let result = tests[n].result
|
||||
if has_key(tests[n], 'skip')
|
||||
call s:show_skip(n+1, name)
|
||||
continue
|
||||
endif
|
||||
if stridx(query, '$$$$') != -1
|
||||
silent! 1new
|
||||
silent! exe "setlocal ft=".type
|
||||
@@ -227,7 +249,7 @@ finish
|
||||
'name': "html:xt>div#header>div#logo+ul#nav>li.item-$*5>a",
|
||||
'query': "html:xt>div#header>div#logo+ul#nav>li.item-$*5>a",
|
||||
'type': "html",
|
||||
'result': "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\">\n<head>\n\t<meta http-equiv=\"Content-Type\" content=\"text/html;charset=UTF-8\" />\n\t<title></title>\n</head>\n<body>\n\t<div id=\"header\">\n\t\t<div id=\"logo\"></div>\n\t\t<ul id=\"nav\">\n\t\t\t<li class=\"item-1\">\n\t\t\t\t<a href=\"\"></a>\n\t\t\t</li>\n\t\t\t<li class=\"item-2\">\n\t\t\t\t<a href=\"\"></a>\n\t\t\t</li>\n\t\t\t<li class=\"item-3\">\n\t\t\t\t<a href=\"\"></a>\n\t\t\t</li>\n\t\t\t<li class=\"item-4\">\n\t\t\t\t<a href=\"\"></a>\n\t\t\t</li>\n\t\t\t<li class=\"item-5\">\n\t\t\t\t<a href=\"\"></a>\n\t\t\t</li>\n\t\t</ul>\n\t</div>\n\t\n</body>\n</html>",
|
||||
'result': "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\">\n<head>\n\t<meta http-equiv=\"Content-Type\" content=\"text/html;charset=UTF-8\" />\n\t<title></title>\n</head>\n<body>\n\t<div id=\"header\">\n\t\t<div id=\"logo\"></div>\n\t\t<ul id=\"nav\">\n\t\t\t<li class=\"item-1\"><a href=\"\"></a></li>\n\t\t\t<li class=\"item-2\"><a href=\"\"></a></li>\n\t\t\t<li class=\"item-3\"><a href=\"\"></a></li>\n\t\t\t<li class=\"item-4\"><a href=\"\"></a></li>\n\t\t\t<li class=\"item-5\"><a href=\"\"></a></li>\n\t\t</ul>\n\t</div>\n\t\n</body>\n</html>",
|
||||
},
|
||||
{
|
||||
'name': "ol>li*2",
|
||||
@@ -290,22 +312,24 @@ finish
|
||||
'result': "<a href=\"\"></a>\n<b></b>\n",
|
||||
},
|
||||
{
|
||||
'name': "a>b>c<d",
|
||||
'query': "a>b>c<d",
|
||||
'name': "a>b>i<b",
|
||||
'query': "a>b>i<b",
|
||||
'type': "html",
|
||||
'result': "<a href=\"\"><b><c></c></b><d></d></a>\n",
|
||||
'result': "<a href=\"\"><b><i></i></b><b></b></a>\n",
|
||||
},
|
||||
{
|
||||
'name': "a>b>c<<d",
|
||||
'query': "a>b>c<<d",
|
||||
'name': "a>b>i<<b",
|
||||
'query': "a>b>i<<b",
|
||||
'type': "html",
|
||||
'result': "<a href=\"\"><b><c></c></b></a>\n<d></d>\n",
|
||||
'result': "<a href=\"\"><b><i></i></b></a>\n<b></b>",
|
||||
'skip': 1,
|
||||
},
|
||||
{
|
||||
'name': "blockquote>b>c<<d",
|
||||
'query': "blockquote>b>c<<d",
|
||||
'name': "blockquote>b>i<<b",
|
||||
'query': "blockquote>b>i<<b",
|
||||
'type': "html",
|
||||
'result': "<blockquote>\n\t<b><c></c></b>\n</blockquote>\n<d></d>\n",
|
||||
'result': "<blockquote><b><i></i></b></blockquote>\n<b></b>",
|
||||
'skip': 1,
|
||||
},
|
||||
{
|
||||
'name': "a[href=foo][class=bar]",
|
||||
@@ -390,6 +414,7 @@ finish
|
||||
'query': "#header>li<#content",
|
||||
'type': "html",
|
||||
'result': "<div id=\"header\">\n\t<li></li>\n</div>\n<div id=\"content\"></div>\n",
|
||||
'skip': 1,
|
||||
},
|
||||
{
|
||||
'name': "(#header>li)<#content",
|
||||
@@ -398,10 +423,11 @@ finish
|
||||
'result': "<div id=\"header\">\n\t<li></li>\n</div>\n<div id=\"content\"></div>\n",
|
||||
},
|
||||
{
|
||||
'name': "a>b>c<<div",
|
||||
'query': "a>b>c<<div",
|
||||
'name': "a>b>i<<div",
|
||||
'query': "a>b>i<<div",
|
||||
'type': "html",
|
||||
'result': "<a href=\"\"><b><c></c></b></a>\n<div></div>\n",
|
||||
'result': "<a href=\"\"><b><i></i></b></a>\n<div></div>\n",
|
||||
'skip': 1,
|
||||
},
|
||||
{
|
||||
'name': "(#header>h1)+#content+#footer",
|
||||
@@ -414,6 +440,7 @@ finish
|
||||
'query': "(#header>h1)+(#content>(#main>h2+div#entry$.section*5>(h3>a)+div>p*3+ul+)+(#utilities))+(#footer>address)",
|
||||
'type': "html",
|
||||
'result': "<div id=\"header\">\n\t<h1></h1>\n</div>\n<div id=\"content\">\n\t<div id=\"main\">\n\t\t<h2></h2>\n\t\t<div id=\"entry1\" class=\"section\">\n\t\t\t<h3>\n\t\t\t\t<a href=\"\"></a>\n\t\t\t</h3>\n\t\t\t<div>\n\t\t\t\t<p></p>\n\t\t\t\t<p></p>\n\t\t\t\t<p></p>\n\t\t\t\t<ul>\n\t\t\t\t\t<li></li>\n\t\t\t\t</ul>\n\t\t\t</div>\n\t\t</div>\n\t\t<div id=\"entry2\" class=\"section\">\n\t\t\t<h3>\n\t\t\t\t<a href=\"\"></a>\n\t\t\t</h3>\n\t\t\t<div>\n\t\t\t\t<p></p>\n\t\t\t\t<p></p>\n\t\t\t\t<p></p>\n\t\t\t\t<ul>\n\t\t\t\t\t<li></li>\n\t\t\t\t</ul>\n\t\t\t</div>\n\t\t</div>\n\t\t<div id=\"entry3\" class=\"section\">\n\t\t\t<h3>\n\t\t\t\t<a href=\"\"></a>\n\t\t\t</h3>\n\t\t\t<div>\n\t\t\t\t<p></p>\n\t\t\t\t<p></p>\n\t\t\t\t<p></p>\n\t\t\t\t<ul>\n\t\t\t\t\t<li></li>\n\t\t\t\t</ul>\n\t\t\t</div>\n\t\t</div>\n\t\t<div id=\"entry4\" class=\"section\">\n\t\t\t<h3>\n\t\t\t\t<a href=\"\"></a>\n\t\t\t</h3>\n\t\t\t<div>\n\t\t\t\t<p></p>\n\t\t\t\t<p></p>\n\t\t\t\t<p></p>\n\t\t\t\t<ul>\n\t\t\t\t\t<li></li>\n\t\t\t\t</ul>\n\t\t\t</div>\n\t\t</div>\n\t\t<div id=\"entry5\" class=\"section\">\n\t\t\t<h3>\n\t\t\t\t<a href=\"\"></a>\n\t\t\t</h3>\n\t\t\t<div>\n\t\t\t\t<p></p>\n\t\t\t\t<p></p>\n\t\t\t\t<p></p>\n\t\t\t\t<ul>\n\t\t\t\t\t<li></li>\n\t\t\t\t</ul>\n\t\t\t</div>\n\t\t</div>\n\t</div>\n\t<div id=\"utilities\"></div>\n</div>\n<div id=\"footer\">\n\t<address></address>\n</div>\n",
|
||||
'skip': 1,
|
||||
},
|
||||
{
|
||||
'name': "(div>(ul*2)*2)+(#utilities)",
|
||||
@@ -462,6 +489,7 @@ finish
|
||||
'query': "link:css",
|
||||
'type': "html",
|
||||
'result': "<link media=\"all\" rel=\"stylesheet\" href=\"style.css\" type=\"text/css\" />\n",
|
||||
'skip': 1,
|
||||
},
|
||||
{
|
||||
'name': "a[title=\"Hello', world\" rel]",
|
||||
@@ -473,7 +501,7 @@ finish
|
||||
'name': "div>a#foo{bar}",
|
||||
'query': "div>a#foo{bar}",
|
||||
'type': "html",
|
||||
'result': "<div>\n\t<a id=\"foo\" href=\"\">bar</a>\n</div>\n",
|
||||
'result': "<div><a id=\"foo\" href=\"\">bar</a></div>\n",
|
||||
},
|
||||
{
|
||||
'name': ".content{Hello!}",
|
||||
|
||||
Reference in New Issue
Block a user