diff --git a/unittest.vim b/unittest.vim index c709c7f..1aaa834 100644 --- a/unittest.vim +++ b/unittest.vim @@ -12,21 +12,35 @@ endfunction call s:reload(expand(':h')) +function! s:show_type(type) + echohl Search | echon "[" a:type "]\n" | echohl None + echo "\r" +endfunction + function! s:show_category(category) echohl MatchParen | echon "[" a:category "]\n" | echohl None echo "\r" endfunction +function! s:escape(str) + let str = a:str + let str = substitute(str, "\n", '\\n', 'g') + let str = substitute(str, "\t", '\\t', 'g') + return str +endfunction + function! s:show_title(no, title) + let title = s:escape(a:title) let width = &columns - 23 echohl ModeMsg | echon "\rtesting #".printf("%03d", a:no) - echohl None | echon ": " . (len(a:title) < width ? (a:title.repeat(' ', width-len(a:title))) : strpart(a:title, 0, width)) . ' ... ' + echohl None | echon ": " . (len(title) < width ? (title.repeat(' ', width-len(title))) : strpart(title, 0, width)) . ' ... ' endfunction function! s:show_skip(no, title) + let title = s:escape(a: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)) . ' ... ' + echohl None | echon ": " . (len(title) < width ? (title.repeat(' ', width-len(title))) : strpart(title, 0, width)) . ' ... ' echo "" endfunction @@ -61,56 +75,58 @@ function! s:testExpandAbbr() unlet! testgroups let testgroups = eval(join(filter(split(substitute(join(readfile(expand('%')), "\n"), '.*\nfinish\n', '', ''), '\n', 1), "v:val !~ '^\"'"))) for testgroup in testgroups - call s:show_category(testgroup.category) - let tests = testgroup.tests - let start = reltime() - for n in range(len(tests)) - let type = tests[n].type - let name = tests[n].name - let query = tests[n].query - let result = tests[n].result - if has_key(tests[n], 'skip') && tests[n].skip != 0 - call s:show_skip(n+1, name) - continue - endif - if stridx(query, '$$$$') != -1 - silent! 1new - silent! exe "setlocal ft=".type - silent! let key = matchstr(query, '.*\$\$\$\$\zs.*\ze\$\$\$\$') - if len(key) > 0 - exe printf('let key = "%s"', key) - else - let key = "\," + call s:show_type(testgroup.type) + let type = testgroup.type + for category in testgroup.categories + call s:show_category(category.name) + let tests = category.tests + let start = reltime() + for n in range(len(tests)) + let query = tests[n].query + let result = tests[n].result + if has_key(tests[n], 'skip') && tests[n].skip != 0 + call s:show_skip(n+1, query) + continue + endif + if stridx(query, '$$$$') != -1 + silent! 1new + silent! exe "setlocal ft=".type + silent! let key = matchstr(query, '.*\$\$\$\$\zs.*\ze\$\$\$\$') + if len(key) > 0 + exe printf('let key = "%s"', key) + else + let key = "\," + endif + silent! let query = substitute(query, '\$\$\$\$.*\$\$\$\$', '$$$$', '') + silent! call setline(1, split(query, "\n")) + let cmd = "normal gg0/\\$\\$\\$\\$\ri\\\\".key + if stridx(result, '$$$$') != -1 + let cmd .= '$$$$' + endif + silent! exe cmd + unlet! res | let res = join(getline(1, line('$')), "\n") + silent! bw! + call s:show_title(n+1, query) + else + call s:show_title(n+1, query) + unlet! res | let res = zencoding#ExpandWord(query, type, 0) endif - silent! let query = substitute(query, '\$\$\$\$.*\$\$\$\$', '$$$$', '') - silent! call setline(1, split(query, "\n")) - let cmd = "normal gg0/\\$\\$\\$\\$\ri\\\\".key if stridx(result, '$$$$') != -1 - let cmd .= '$$$$' - endif - silent! exe cmd - unlet! res | let res = join(getline(1, line('$')), "\n") - silent! bw! - call s:show_title(n+1, name) - else - call s:show_title(n+1, name) - unlet! res | let res = zencoding#ExpandWord(query, type, 0) - endif - if stridx(result, '$$$$') != -1 - if res ==# result - call s:show_ok() + if res ==# result + call s:show_ok() + else + call s:show_ng(n+1, result, res) + endif else - call s:show_ng(n+1, result, res) + if res ==# result + call s:show_ok() + else + call s:show_ng(n+1, result, res) + endif endif - else - if res ==# result - call s:show_ok() - else - call s:show_ng(n+1, result, res) - endif - endif + endfor + echo "past:".reltimestr(reltime(start))."\n" endfor - echo "past:".reltimestr(reltime(start))."\n" endfor endfunction @@ -189,585 +205,472 @@ echo "done" finish [ { - 'category': 'html', - 'tests': [ - { - 'name': "div", - 'query': "div", - 'type': "html", - 'result': "
\n", - }, - { - 'name': "div#wrapper", - 'query': "div#wrapper", - 'type': "html", - 'result': "
\n", - }, - { - 'name': "div.box", - 'query': "div.box", - 'type': "html", - 'result': "
\n", - }, - { - 'name': "a[title=TITLE]", - 'query': "a[title=TITLE]", - 'type': "html", - 'result': "\n", - }, - { - 'name': "div#wrapper.box", - 'query': "div#wrapper.box", - 'type': "html", - 'result': "
\n", - }, - { - 'name': "div#wrapper.box.current", - 'query': "div#wrapper.box.current", - 'type': "html", - 'result': "
\n", - }, - { - 'name': "div#wrapper.box.current[title=TITLE rel]", - 'query': "div#wrapper.box.current[title=TITLE rel]", - 'type': "html", - 'result': "
\n", - }, - { - 'name': "div#main+div#sub", - 'query': "div#main+div#sub", - 'type': "html", - 'result': "
\n
\n", - }, - { - 'name': "div#main>div#sub", - 'query': "div#main>div#sub", - 'type': "html", - 'result': "
\n\t
\n
\n", - }, - { - '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': "\n\n\n\t\n\t\n\n\n\t
\n\t\t
\n\t\t
    \n\t\t\t
  • \n\t\t\t
  • \n\t\t\t
  • \n\t\t\t
  • \n\t\t\t
  • \n\t\t
\n\t
\n\t\n\n", - }, - { - 'name': "ol>li*2", - 'query': "ol>li*2", - 'type': "html", - 'result': "
    \n\t
  1. \n\t
  2. \n
\n", - }, - { - 'name': "a", - 'query': "a", - 'type': "html", - 'result': "\n", - }, - { - 'name': "obj", - 'query': "obj", - 'type': "html", - 'result': "\n", - }, - { - 'name': "cc:ie6>p+blockquote#sample$.so.many.classes*2", - 'query': "cc:ie6>p+blockquote#sample$.so.many.classes*2", - 'type': "html", - 'result': "", - }, - { - 'name': "tm>if>div.message", - 'query': "tm>if>div.message", - 'type': "html", - 'result': "\n\t\n\t\t
\n\t
\n
\n", - }, - { - 'name': "html:4t>div#wrapper>div#header+div#contents+div#footer", - 'query': "html:4t>div#wrapper>div#header+div#contents+div#footer", - 'type': "html", - 'result': "\n\n\n\t\n\t\n\n\n\t
\n\t\t
\n\t\t
\n\t\t
\n\t
\n\t\n\n", - }, - { - 'name': "a[href=http://www.google.com/].foo#hoge", - 'query': "a[href=http://www.google.com/].foo#hoge", - 'type': "html", - 'result': "\n", - }, - { - 'name': "a[href=http://www.google.com/]{Google}", - 'query': "a[href=http://www.google.com/]{Google}", - 'type': "html", - 'result': "Google\n", - }, - { - 'name': "{ZenCoding}", - 'query': "{ZenCoding}", - 'type': "html", - 'result': "ZenCoding", - }, - { - 'name': "a+b", - 'query': "a+b", - 'type': "html", - 'result': "\n\n", - }, - { - 'name': "a>b>ib>i\n", - }, - { - 'name': "a>b>i<b>i<\n\n", - }, - { - 'name': "blockquote>b>i<b>i<\n\n", - }, - { - 'name': "a[href=foo][class=bar]", - 'query': "a[href=foo][class=bar]", - 'type': "html", - 'result': "\n", - }, - { - 'name': "a[a=b][b=c=d][e]{foo}*2", - 'query': "a[a=b][b=c=d][e]{foo}*2", - 'type': "html", - 'result': "foo\nfoo\n", - }, - { - 'name': "a[a=b][b=c=d][e]*2{foo}", - 'query': "a[a=b][b=c=d][e]*2{foo}", - 'type': "html", - 'result': "\n\nfoo", - }, - { - 'name': "a*2{foo}a", - 'query': "a*2{foo}a", - 'type': "html", - 'result': "\n\nfoo\n", - }, - { - 'name': "a{foo}*2>b", - 'query': "a{foo}*2>b", - 'type': "html", - 'result': "foo\nfoo\n", - }, - { - 'name': "a*2{foo}>b", - 'query': "a*2{foo}>b", - 'type': "html", - 'result': "\n\nfoo", - }, - { - 'name': "table>tr>td.name#foo+td*3", - 'query': "table>tr>td.name#foo+td*3", - 'type': "html", - 'result': "\n\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\n
\n", - }, - { - 'name': "div#header + div#footer", - 'query': "div#header + div#footer", - 'type': "html", - 'result': "
\n
\n", - }, - { - 'name': "#header + div#footer", - 'query': "#header + div#footer", - 'type': "html", - 'result': "
\n
\n", - }, - { - 'name': "#header > ul > li < p{Footer}", - 'query': "#header > ul > li < p{Footer}", - 'type': "html", - 'result': "
\n\t
    \n\t\t
  • \n\t
\n\t

Footer

\n
\n", - }, - { - 'name': "a#foo$$$*3", - 'query': "a#foo$$$*3", - 'type': "html", - 'result': "\n\n\n", - }, - { - 'name': "ul+", - 'query': "ul+", - 'type': "html", - 'result': "
    \n\t
  • \n
\n", - }, - { - 'name': "table+", - 'query': "table+", - 'type': "html", - 'result': "\n\t\n\t\t\n\t\n
\n", - }, - { - 'name': "#header>li<#content", - 'query': "#header>li<#content", - 'type': "html", - 'result': "
\n\t
  • \n
    \n
    \n", - }, - { - 'name': "(#header>li)<#content", - 'query': "(#header>li)<#content", - 'type': "html", - 'result': "
    \n\t
  • \n
    \n
    \n", - }, - { - 'name': "a>b>i<b>i<\n
    \n", - }, - { - 'name': "(#header>h1)+#content+#footer", - 'query': "(#header>h1)+#content+#footer", - 'type': "html", - 'result': "
    \n\t

    \n
    \n
    \n
    \n", - }, - { - 'name': "(#header>h1)+(#content>(#main>h2+div#entry$.section*5>(h3>a)+div>p*3+ul+)+(#utilities))+(#footer>address)", - 'query': "(#header>h1)+(#content>(#main>h2+div#entry$.section*5>(h3>a)+div>p*3+ul+)+(#utilities))+(#footer>address)", - 'type': "html", - 'result': "
    \n\t

    \n
    \n
    \n\t
    \n\t\t

    \n\t\t
    \n\t\t\t

    \n\t\t\t
    \n\t\t\t\t

    \n\t\t\t\t

    \n\t\t\t\t

    \n\t\t\t\t
      \n\t\t\t\t\t
    • \n\t\t\t\t
    \n\t\t\t
    \n\t\t
    \n\t\t
    \n\t\t\t

    \n\t\t\t
    \n\t\t\t\t

    \n\t\t\t\t

    \n\t\t\t\t

    \n\t\t\t\t
      \n\t\t\t\t\t
    • \n\t\t\t\t
    \n\t\t\t
    \n\t\t
    \n\t\t
    \n\t\t\t

    \n\t\t\t
    \n\t\t\t\t

    \n\t\t\t\t

    \n\t\t\t\t

    \n\t\t\t\t
      \n\t\t\t\t\t
    • \n\t\t\t\t
    \n\t\t\t
    \n\t\t
    \n\t\t
    \n\t\t\t

    \n\t\t\t
    \n\t\t\t\t

    \n\t\t\t\t

    \n\t\t\t\t

    \n\t\t\t\t
      \n\t\t\t\t\t
    • \n\t\t\t\t
    \n\t\t\t
    \n\t\t
    \n\t\t
    \n\t\t\t

    \n\t\t\t
    \n\t\t\t\t

    \n\t\t\t\t

    \n\t\t\t\t

    \n\t\t\t\t
      \n\t\t\t\t\t
    • \n\t\t\t\t
    \n\t\t\t
    \n\t\t
    \n\t
    \n\t
    \n
    \n
    \n\t
    \n
    \n", - }, - { - 'name': "(div>(ul*2)*2)+(#utilities)", - 'query': "(div>(ul*2)*2)+(#utilities)", - 'type': "html", - 'result': "
    \n\t
      \n\t
        \n\t
          \n\t
            \n
            \n
            \n", - }, - { - 'name': "table>(tr>td*3)*4", - 'query': "table>(tr>td*3)*4", - 'type': "html", - 'result': "\n\t\n\t\t\n\t\t\n\t\t\n\t\n\t\n\t\t\n\t\t\n\t\t\n\t\n\t\n\t\t\n\t\t\n\t\t\n\t\n\t\n\t\t\n\t\t\n\t\t\n\t\n
            \n", - }, - { - 'name': "(((a#foo+a#bar)*2)*3)", - 'query': "(((a#foo+a#bar)*2)*3)", - 'type': "html", - 'result': "\n\n\n\n\n\n\n\n\n\n\n\n", - }, - { - 'name': "div#box$*3>h3+p*2", - 'query': "div#box$*3>h3+p*2", - 'type': "html", - 'result': "
            \n\t

            \n\t

            \n\t

            \n
            \n
            \n\t

            \n\t

            \n\t

            \n
            \n
            \n\t

            \n\t

            \n\t

            \n
            \n" - }, - { - 'name': "div#box.foo$$$.bar$$$*3", - 'query': "div#box.foo$$$.bar$$$*3", - 'type': "html", - 'result': "
            \n
            \n
            \n", - }, - { - 'name': "div#box$*3>h3+p.bar*2|e", - 'query': "div#box$*3>h3+p.bar*2|e", - 'type': "html", - 'result': "<div id=\"box1\">\n\t&lt;h3&gt;&lt;/h3&gt;\n\t&lt;p class=\"bar\"&gt;&lt;/p&gt;\n\t&lt;p class=\"bar\"&gt;&lt;/p&gt;\n</div>\n<div id=\"box2\">\n\t&lt;h3&gt;&lt;/h3&gt;\n\t&lt;p class=\"bar\"&gt;&lt;/p&gt;\n\t&lt;p class=\"bar\"&gt;&lt;/p&gt;\n</div>\n<div id=\"box3\">\n\t&lt;h3&gt;&lt;/h3&gt;\n\t&lt;p class=\"bar\"&gt;&lt;/p&gt;\n\t&lt;p class=\"bar\"&gt;&lt;/p&gt;\n</div>\n", - }, - { - 'name': "div>div#page>p.title+p|c", - 'query': "div>div#page>p.title+p|c", - 'type': "html", - 'result': "
            \n\t\n\t
            \n\t\t\n\t\t

            \n\t\t\n\t\t

            \n\t
            \n\t\n
            \n", - }, - { - 'name': "link:css", - 'query': "link:css", - 'type': "html", - 'result': "\n", - }, - { - 'name': "a[title=\"Hello', world\" rel]", - 'query': "a[title=\"Hello', world\" rel]", - 'type': "html", - 'result': "\n", - }, - { - 'name': "div>a#foo{bar}", - 'query': "div>a#foo{bar}", - 'type': "html", - 'result': "\n", - }, - { - 'name': ".content{Hello!}", - 'query': ".content{Hello!}", - 'type': "html", - 'result': "
            Hello!
            \n", - }, - { - 'name': "div.logo+(div#navigation)+(div#links)", - 'query': "div.logo+(div#navigation)+(div#links)", - 'type': "html", - 'result': "
            \n
            \n
            \n", - }, - { - 'name': "h1{header}+{Text}+a[href=http://link.org]{linktext}+{again some text}+a[href=http://anoterlink.org]{click me!}+{some final text}", - 'query': "h1{header}+{Text}+a[href=http://link.org]{linktext}+{again some text}+a[href=http://anoterlink.org]{click me!}+{some final text}", - 'type': "html", - 'result': "

            header

            \nTextlinktext\nagain some textclick me!\nsome final text", - }, - { - 'name': "a{&}+div{&&}", - 'query': "a{&}+div{&&}", - 'type': "html", - 'result': "&\n
            &&
            \n", - }, - { - 'name': "span$$$$\\,$$$$", - 'query': "span$$$$\\,$$$$", - 'type': "html", - 'result': "", - }, - { - 'name': "foo span$$$$\\,$$$$", - 'query': "foo span$$$$\\,$$$$", - 'type': "html", - 'result': "foo ", - }, - { - 'name': "foo span$$$$\\,$$$$ bar", - 'query': "foo span$$$$\\,$$$$ bar", - 'type': "html", - 'result': "foo bar", - }, - { - 'name': "foo $$$$\\ve\\,p\\$$$$bar baz", - 'query': "foo $$$$\\ve\\,p\\$$$$bar baz", - 'type': "html", - 'result': "foo

            bar

            baz", - }, - { - 'name': "foo $$$$\\vee\\,p\\$$$$bar baz", - 'query': "foo $$$$\\vee\\,p\\$$$$bar baz", - 'type': "html", - 'result': "foo

            bar baz

            ", - }, - { - 'name': "f div.boxes>article.box2>header>(hgroup>h2{aaa}+h3{bbb})+p{ccc}$$$$", - 'query': "f div.boxes>article.box2>header>(hgroup>h2{aaa}+h3{bbb})+p{ccc}$$$$", - 'type': "html", - 'result': "f
            \n\t
            \n\t\t
            \n\t\t\t
            \n\t\t\t\t

            aaa

            \n\t\t\t\t

            bbb

            \n\t\t\t
            \n\t\t\t

            ccc

            \n\t\t
            \n\t
            \n
            ", - }, - { - 'name': "div.boxes>(div.box2>section>h2{a}+p{b})+(div.box1>section>h2{c}+p{d}+p{e}+(bq>h2{f}+h3{g})+p{h})", - 'query': "div.boxes>(div.box2>section>h2{a}+p{b})+(div.box1>section>h2{c}+p{d}+p{e}+(bq>h2{f}+h3{g})+p{h})", - 'type': "html", - 'result': "
            \n\t
            \n\t\t
            \n\t\t\t

            a

            \n\t\t\t

            b

            \n\t\t
            \n\t
            \n\t
            \n\t\t
            \n\t\t\t

            c

            \n\t\t\t

            d

            \n\t\t\t

            e

            \n\t\t\t
            \n\t\t\t\t

            f

            \n\t\t\t\t

            g

            \n\t\t\t
            \n\t\t\t

            h

            \n\t\t
            \n\t
            \n
            \n", - }, - { - 'name': "join tag", - 'query': "
            \n\t$$$$\\j$$$$\n
            ", - 'type': "html", - 'result': "
            \n\t\n
            ", - }, - { - 'name': "split tag", - 'query': "
            \n\tj$$$$/>\n
            ", - 'type': "html", - 'result': "
            \n\t\n
            ", - }, - { - 'name': "comment tag", - 'query': "
            \n\t$$$$\\/$$$$\n
            ", - 'type': "html", - 'result': "
            \n\t\n
            ", - }, - { - 'name': "uncomment tag", - 'query': "
            \n\t\n
            ", - 'type': "html", - 'result': "
            \n\t\n
            ", + 'type': "html", + 'categories': [ + { + 'name': 'expand abbreviation', + 'tests': [ + { + 'query': "div", + 'result': "
            \n", + }, + { + 'query': "div#wrapper", + 'result': "
            \n", + }, + { + 'query': "div.box", + 'result': "
            \n", + }, + { + 'query': "a[title=TITLE]", + 'result': "\n", + }, + { + 'query': "div#wrapper.box", + 'result': "
            \n", + }, + { + 'query': "div#wrapper.box.current", + 'result': "
            \n", + }, + { + 'query': "div#wrapper.box.current[title=TITLE rel]", + 'result': "
            \n", + }, + { + 'query': "div#main+div#sub", + 'result': "
            \n
            \n", + }, + { + 'query': "div#main>div#sub", + 'result': "
            \n\t
            \n
            \n", + }, + { + 'query': "html:xt>div#header>div#logo+ul#nav>li.item-$*5>a", + 'result': "\n\n\n\t\n\t\n\n\n\t
            \n\t\t
            \n\t\t
              \n\t\t\t
            • \n\t\t\t
            • \n\t\t\t
            • \n\t\t\t
            • \n\t\t\t
            • \n\t\t
            \n\t
            \n\t\n\n", + }, + { + 'query': "ol>li*2", + 'result': "
              \n\t
            1. \n\t
            2. \n
            \n", + }, + { + 'query': "a", + 'result': "\n", + }, + { + 'query': "obj", + 'result': "\n", + }, + { + 'query': "cc:ie6>p+blockquote#sample$.so.many.classes*2", + 'result': "", + }, + { + 'query': "tm>if>div.message", + 'result': "\n\t\n\t\t
            \n\t
            \n
            \n", + }, + { + 'query': "html:4t>div#wrapper>div#header+div#contents+div#footer", + 'result': "\n\n\n\t\n\t\n\n\n\t
            \n\t\t
            \n\t\t
            \n\t\t
            \n\t
            \n\t\n\n", + }, + { + 'query': "a[href=http://www.google.com/].foo#hoge", + 'result': "\n", + }, + { + 'query': "a[href=http://www.google.com/]{Google}", + 'result': "Google\n", + }, + { + 'query': "{ZenCoding}", + 'result': "ZenCoding", + }, + { + 'query': "a+b", + 'result': "\n\n", + }, + { + 'query': "a>b>i\n", + }, + { + 'query': "a>b>i<\n\n", + }, + { + 'query': "blockquote>b>i<\n\n", + }, + { + 'query': "a[href=foo][class=bar]", + 'result': "\n", + }, + { + 'query': "a[a=b][b=c=d][e]{foo}*2", + 'result': "foo\nfoo\n", + }, + { + 'query': "a[a=b][b=c=d][e]*2{foo}", + 'result': "\n\nfoo", + }, + { + 'query': "a*2{foo}a", + 'result': "\n\nfoo\n", + }, + { + 'query': "a{foo}*2>b", + 'result': "foo\nfoo\n", + }, + { + 'query': "a*2{foo}>b", + 'result': "\n\nfoo", + }, + { + 'query': "table>tr>td.name#foo+td*3", + 'result': "\n\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\n
            \n", + }, + { + 'query': "div#header + div#footer", + 'result': "
            \n
            \n", + }, + { + 'query': "#header + div#footer", + 'result': "
            \n
            \n", + }, + { + 'query': "#header > ul > li < p{Footer}", + 'result': "
            \n\t
              \n\t\t
            • \n\t
            \n\t

            Footer

            \n
            \n", + }, + { + 'query': "a#foo$$$*3", + 'result': "\n\n\n", + }, + { + 'query': "ul+", + 'result': "
              \n\t
            • \n
            \n", + }, + { + 'query': "table+", + 'result': "\n\t\n\t\t\n\t\n
            \n", + }, + { + 'query': "#header>li<#content", + 'result': "
            \n\t
          • \n
            \n
            \n", + }, + { + 'query': "(#header>li)<#content", + 'result': "
            \n\t
          • \n
            \n
            \n", + }, + { + 'query': "a>b>i<\n
            \n", + }, + { + 'query': "(#header>h1)+#content+#footer", + 'result': "
            \n\t

            \n
            \n
            \n
            \n", + }, + { + 'query': "(#header>h1)+(#content>(#main>h2+div#entry$.section*5>(h3>a)+div>p*3+ul+)+(#utilities))+(#footer>address)", + 'result': "
            \n\t

            \n
            \n
            \n\t
            \n\t\t

            \n\t\t
            \n\t\t\t

            \n\t\t\t
            \n\t\t\t\t

            \n\t\t\t\t

            \n\t\t\t\t

            \n\t\t\t\t
              \n\t\t\t\t\t
            • \n\t\t\t\t
            \n\t\t\t
            \n\t\t
            \n\t\t
            \n\t\t\t

            \n\t\t\t
            \n\t\t\t\t

            \n\t\t\t\t

            \n\t\t\t\t

            \n\t\t\t\t
              \n\t\t\t\t\t
            • \n\t\t\t\t
            \n\t\t\t
            \n\t\t
            \n\t\t
            \n\t\t\t

            \n\t\t\t
            \n\t\t\t\t

            \n\t\t\t\t

            \n\t\t\t\t

            \n\t\t\t\t
              \n\t\t\t\t\t
            • \n\t\t\t\t
            \n\t\t\t
            \n\t\t
            \n\t\t
            \n\t\t\t

            \n\t\t\t
            \n\t\t\t\t

            \n\t\t\t\t

            \n\t\t\t\t

            \n\t\t\t\t
              \n\t\t\t\t\t
            • \n\t\t\t\t
            \n\t\t\t
            \n\t\t
            \n\t\t
            \n\t\t\t

            \n\t\t\t
            \n\t\t\t\t

            \n\t\t\t\t

            \n\t\t\t\t

            \n\t\t\t\t
              \n\t\t\t\t\t
            • \n\t\t\t\t
            \n\t\t\t
            \n\t\t
            \n\t
            \n\t
            \n
            \n
            \n\t
            \n
            \n", + }, + { + 'query': "(div>(ul*2)*2)+(#utilities)", + 'result': "
            \n\t
              \n\t
                \n\t
                  \n\t
                    \n
                    \n
                    \n", + }, + { + 'query': "table>(tr>td*3)*4", + 'result': "\n\t\n\t\t\n\t\t\n\t\t\n\t\n\t\n\t\t\n\t\t\n\t\t\n\t\n\t\n\t\t\n\t\t\n\t\t\n\t\n\t\n\t\t\n\t\t\n\t\t\n\t\n
                    \n", + }, + { + 'query': "(((a#foo+a#bar)*2)*3)", + 'result': "\n\n\n\n\n\n\n\n\n\n\n\n", + }, + { + 'query': "div#box$*3>h3+p*2", + 'result': "
                    \n\t

                    \n\t

                    \n\t

                    \n
                    \n
                    \n\t

                    \n\t

                    \n\t

                    \n
                    \n
                    \n\t

                    \n\t

                    \n\t

                    \n
                    \n" + }, + { + 'query': "div#box.foo$$$.bar$$$*3", + 'result': "
                    \n
                    \n
                    \n", + }, + { + 'query': "div#box$*3>h3+p.bar*2|e", + 'result': "<div id=\"box1\">\n\t&lt;h3&gt;&lt;/h3&gt;\n\t&lt;p class=\"bar\"&gt;&lt;/p&gt;\n\t&lt;p class=\"bar\"&gt;&lt;/p&gt;\n</div>\n<div id=\"box2\">\n\t&lt;h3&gt;&lt;/h3&gt;\n\t&lt;p class=\"bar\"&gt;&lt;/p&gt;\n\t&lt;p class=\"bar\"&gt;&lt;/p&gt;\n</div>\n<div id=\"box3\">\n\t&lt;h3&gt;&lt;/h3&gt;\n\t&lt;p class=\"bar\"&gt;&lt;/p&gt;\n\t&lt;p class=\"bar\"&gt;&lt;/p&gt;\n</div>\n", + }, + { + 'query': "div>div#page>p.title+p|c", + 'result': "
                    \n\t\n\t
                    \n\t\t\n\t\t

                    \n\t\t\n\t\t

                    \n\t
                    \n\t\n
                    \n", + }, + { + 'query': "link:css", + 'result': "\n", + }, + { + 'query': "a[title=\"Hello', world\" rel]", + 'result': "\n", + }, + { + 'query': "div>a#foo{bar}", + 'result': "\n", + }, + { + 'query': ".content{Hello!}", + 'result': "
                    Hello!
                    \n", + }, + { + 'query': "div.logo+(div#navigation)+(div#links)", + 'result': "
                    \n
                    \n
                    \n", + }, + { + 'query': "h1{header}+{Text}+a[href=http://link.org]{linktext}+{again some text}+a[href=http://anoterlink.org]{click me!}+{some final text}", + 'result': "

                    header

                    \nTextlinktext\nagain some textclick me!\nsome final text", + }, + { + 'query': "a{&}+div{&&}", + 'result': "&\n
                    &&
                    \n", + }, + { + 'query': "span$$$$\\,$$$$", + 'result': "", + }, + { + 'query': "foo span$$$$\\,$$$$", + 'result': "foo ", + }, + { + 'query': "foo span$$$$\\,$$$$ bar", + 'result': "foo bar", + }, + { + 'query': "foo $$$$\\ve\\,p\\$$$$bar baz", + 'result': "foo

                    bar

                    baz", + }, + { + 'query': "foo $$$$\\vee\\,p\\$$$$bar baz", + 'result': "foo

                    bar baz

                    ", + }, + { + 'query': "f div.boxes>article.box2>header>(hgroup>h2{aaa}+h3{bbb})+p{ccc}$$$$", + 'result': "f
                    \n\t
                    \n\t\t
                    \n\t\t\t
                    \n\t\t\t\t

                    aaa

                    \n\t\t\t\t

                    bbb

                    \n\t\t\t
                    \n\t\t\t

                    ccc

                    \n\t\t
                    \n\t
                    \n
                    ", + }, + { + 'query': "div.boxes>(div.box2>section>h2{a}+p{b})+(div.box1>section>h2{c}+p{d}+p{e}+(bq>h2{f}+h3{g})+p{h})", + 'result': "
                    \n\t
                    \n\t\t
                    \n\t\t\t

                    a

                    \n\t\t\t

                    b

                    \n\t\t
                    \n\t
                    \n\t
                    \n\t\t
                    \n\t\t\t

                    c

                    \n\t\t\t

                    d

                    \n\t\t\t

                    e

                    \n\t\t\t
                    \n\t\t\t\t

                    f

                    \n\t\t\t\t

                    g

                    \n\t\t\t
                    \n\t\t\t

                    h

                    \n\t\t
                    \n\t
                    \n
                    \n", + }, + ], + }, + { + 'name': 'split join tag', + 'tests': [ + { + 'query': "
                    \n\t$$$$\\j$$$$\n
                    ", + 'result': "
                    \n\t\n
                    ", + }, + { + 'query': "
                    \n\tj$$$$/>\n
                    ", + 'result': "
                    \n\t\n
                    ", + }, + ], + }, + { + 'name': 'toggle comment', + 'tests': [ + { + 'query': "
                    \n\t$$$$\\/$$$$\n
                    ", + 'result': "
                    \n\t\n
                    ", + }, + { + 'query': "
                    \n\t\n
                    ", + 'result': "
                    \n\t\n
                    ", + }, + ], }, ], }, { - 'category': 'css', - 'tests': [ + 'type': 'css', + 'categories': [ { - 'name': "@i", - 'query': "@i", - 'type': "css", - 'result': "@import url();", - }, - { - 'name': "fs:n", - 'query': "fs:n", - 'type': "css", - 'result': "font-style: normal;", - }, - { - 'name': "fl:l|fc", - 'query': "fl:l|fc", - 'type': "css", - 'result': "float: left;", - }, - { - 'name': "bg+$$$$", - 'query': "bg+$$$$", - 'type': "css", - 'result': "background: #FFF url($$$$) 0 0 no-repeat;", + 'name': 'expand abbreviation', + 'tests': [ + { + 'query': "@i", + 'result': "@import url();", + }, + { + 'query': "fs:n", + 'result': "font-style: normal;", + }, + { + 'query': "fl:l|fc", + 'result': "float: left;", + }, + { + 'query': "bg+$$$$", + 'result': "background: #FFF url($$$$) 0 0 no-repeat;", + }, + ], }, ], }, { - 'category': 'haml', - 'tests': [ + 'type': 'haml', + 'categories': [ { - 'name': "div>p+ul#foo>li.bar$[foo=bar][bar=baz]*3>{baz}", - 'query': "div>p+ul#foo>li.bar$[foo=bar][bar=baz]*3>{baz}", - 'type': "haml", - 'result': "%div\n %p\n %ul#foo\n %li.bar1{ :foo => \"bar\", :bar => \"baz\" } baz\n %li.bar2{ :foo => \"bar\", :bar => \"baz\" } baz\n %li.bar3{ :foo => \"bar\", :bar => \"baz\" } baz\n", + 'name': 'expand abbreviation', + 'tests': [ + { + 'query': "div>p+ul#foo>li.bar$[foo=bar][bar=baz]*3>{baz}", + 'result': "%div\n %p\n %ul#foo\n %li.bar1{ :foo => \"bar\", :bar => \"baz\" } baz\n %li.bar2{ :foo => \"bar\", :bar => \"baz\" } baz\n %li.bar3{ :foo => \"bar\", :bar => \"baz\" } baz\n", + }, + { + 'query': "div>p+ul#foo>li.bar$[foo=bar][bar=baz]*3>{baz}|haml", + 'result': "%div\n %p\n %ul#foo\n %li.bar1{ :foo => \"bar\", :bar => \"baz\" } baz\n %li.bar2{ :foo => \"bar\", :bar => \"baz\" } baz\n %li.bar3{ :foo => \"bar\", :bar => \"baz\" } baz\n", + }, + { + 'query': "a*3|haml", + 'result': "%a{ :href => \"\" }\n%a{ :href => \"\" }\n%a{ :href => \"\" }\n", + }, + { + 'query': ".content{Hello!}|haml", + 'result': "%div.content Hello!\n", + }, + ], }, { - 'name': "div>p+ul#foo>li.bar$[foo=bar][bar=baz]*3>{baz}|haml", - 'query': "div>p+ul#foo>li.bar$[foo=bar][bar=baz]*3>{baz}|haml", - 'type': "html", - 'result': "%div\n %p\n %ul#foo\n %li.bar1{ :foo => \"bar\", :bar => \"baz\" } baz\n %li.bar2{ :foo => \"bar\", :bar => \"baz\" } baz\n %li.bar3{ :foo => \"bar\", :bar => \"baz\" } baz\n", + 'name': 'expand abbreviation', + 'tests': [ + { + 'query': "%a foo\n bar$$$$\\j$$$$", + 'result': "%a ", + }, + { + 'query': "$$$$\\j$$$$%a ", + 'result': "%a $$$$", + }, + ], }, { - 'name': "a*3|haml", - 'query': "a*3|haml", - 'type': "haml", - 'result': "%a{ :href => \"\" }\n%a{ :href => \"\" }\n%a{ :href => \"\" }\n", - }, - { - 'name': ".content{Hello!}|haml", - 'query': ".content{Hello!}|haml", - 'type': "haml", - 'result': "%div.content Hello!\n", - }, - { - 'name': "join tag", - 'query': "%a foo\n bar$$$$\\j$$$$", - 'type': "haml", - 'result': "%a ", - }, - { - 'name': "split tag", - 'query': "$$$$\\j$$$$%a ", - 'type': "haml", - 'result': "%a $$$$", - }, - { - 'name': "comment tag", - 'query': "%a{ :href => \"http://www.google.com\"$$$$\\/$$$$ } hello", - 'type': "haml", - 'result': "-# %a{ :href => \"http://www.google.com\" } hello", - }, - { - 'name': "uncomment tag", - 'query': "-# %a{ :href => \"http://www.google.com\"$$$$\\/$$$$ } hello", - 'type': "haml", - 'result': "%a{ :href => \"http://www.google.com\" } hello", + 'name': 'toggle comment', + 'tests': [ + { + 'query': "%a{ :href => \"http://www.google.com\"$$$$\\/$$$$ } hello", + 'result': "-# %a{ :href => \"http://www.google.com\" } hello", + }, + { + 'query': "-# %a{ :href => \"http://www.google.com\"$$$$\\/$$$$ } hello", + 'result': "%a{ :href => \"http://www.google.com\" } hello", + }, + ], }, ], }, { - 'category': 'slim', - 'tests': [ + 'type': 'slim', + 'categories': [ { - 'name': "div>p+ul#foo>li.bar$[foo=bar][bar=baz]*3>{baz}", - 'query': "div>p+ul#foo>li.bar$[foo=bar][bar=baz]*3>{baz}", - 'type': "slim", - 'result': "div\n p\n ul id=\"foo\"\n li foo=\"bar\" bar=\"baz\" class=\"bar1\"\n | baz\n li foo=\"bar\" bar=\"baz\" class=\"bar2\"\n | baz\n li foo=\"bar\" bar=\"baz\" class=\"bar3\"\n | baz\n", + 'name': 'expand abbreviation', + 'tests': [ + { + 'query': "div>p+ul#foo>li.bar$[foo=bar][bar=baz]*3>{baz}", + 'result': "div\n p\n ul id=\"foo\"\n li foo=\"bar\" bar=\"baz\" class=\"bar1\"\n | baz\n li foo=\"bar\" bar=\"baz\" class=\"bar2\"\n | baz\n li foo=\"bar\" bar=\"baz\" class=\"bar3\"\n | baz\n", + }, + { + 'query': "div>p+ul#foo>li.bar$[foo=bar][bar=baz]*3>{baz}|slim", + 'result': "div\n p\n ul id=\"foo\"\n li foo=\"bar\" bar=\"baz\" class=\"bar1\"\n | baz\n li foo=\"bar\" bar=\"baz\" class=\"bar2\"\n | baz\n li foo=\"bar\" bar=\"baz\" class=\"bar3\"\n | baz\n", + }, + { + 'query': "a*3|slim", + 'result': "a href=\"\"\na href=\"\"\na href=\"\"\n", + }, + { + 'query': ".content{Hello!}|slim", + 'result': "div class=\"content\"\n | Hello!\n", + }, + ], }, { - 'name': "div>p+ul#foo>li.bar$[foo=bar][bar=baz]*3>{baz}|slim", - 'query': "div>p+ul#foo>li.bar$[foo=bar][bar=baz]*3>{baz}|slim", - 'type': "html", - 'result': "div\n p\n ul id=\"foo\"\n li foo=\"bar\" bar=\"baz\" class=\"bar1\"\n | baz\n li foo=\"bar\" bar=\"baz\" class=\"bar2\"\n | baz\n li foo=\"bar\" bar=\"baz\" class=\"bar3\"\n | baz\n", + 'name': 'split join tag', + 'tests': [ + { + 'query': "a\n | foo$$$$\\j$$$$", + 'result': "a", + }, + { + 'query': "a$$$$\\j$$$$", + 'result': "a\n | $$$$", + }, + ], }, { - 'name': "a*3|slim", - 'query': "a*3|slim", - 'type': "slim", - 'result': "a href=\"\"\na href=\"\"\na href=\"\"\n", - }, - { - 'name': ".content{Hello!}|slim", - 'query': ".content{Hello!}|slim", - 'type': "slim", - 'result': "div class=\"content\"\n | Hello!\n", - }, - { - 'name': "join tag", - 'query': "a\n | foo$$$$\\j$$$$", - 'type': "slim", - 'result': "a", - }, - { - 'name': "split tag", - 'query': "a$$$$\\j$$$$", - 'type': "slim", - 'result': "a\n | $$$$", - }, - { - 'name': "comment tag", - 'query': "a href=\"http://www.google.com\"$$$$\\/$$$$\n | hello", - 'type': "slim", - 'result': "/a href=\"http://www.google.com\"\n | hello", - }, - { - 'name': "uncomment tag", - 'query': "/a href=\"http://www.google.com\"$$$$\\/$$$$\n | hello", - 'type': "slim", - 'result': "a href=\"http://www.google.com\"\n | hello", + 'name': 'toggle comment', + 'tests': [ + { + 'query': "a href=\"http://www.google.com\"$$$$\\/$$$$\n | hello", + 'result': "/a href=\"http://www.google.com\"\n | hello", + }, + { + 'query': "/a href=\"http://www.google.com\"$$$$\\/$$$$\n | hello", + 'result': "a href=\"http://www.google.com\"\n | hello", + }, + ], }, ], }, { - 'category': 'xsl', - 'tests': [ + 'type': 'xsl', + 'categories': [ { - 'name': "vari", - 'query': "vari", - 'type': "xsl", - 'result': "\n", - }, - { - 'name': "ap>wp", - 'query': "ap>wp", - 'type': "xsl", - 'result': "\n\t\n\n", + 'name': 'expand abbreviation', + 'tests': [ + { + 'query': "vari", + 'result': "\n", + }, + { + 'query': "ap>wp", + 'result': "\n\t\n\n", + }, + ], }, ], }, { - 'category': 'xsd', - 'tests': [ + 'type': 'xsd', + 'categories': [ { - 'name': "w3c", - 'query': "xsd:w3c", - 'type': "xsd", - 'result': "\n\n\t\n", + 'name': 'expand abbreviation', + 'tests': [ + { + 'query': "xsd:w3c", + 'result': "\n\n\t\n", + }, + ], }, ], }, { - 'category': 'mustache', - 'tests': [ - { - 'name': "div#{{foo}}", - 'query': "div#{{foo}}", - 'type': "mustache", - 'result': "
                    \n", - }, - { - 'name': "div.{{foo}}", - 'query': "div.{{foo}}", - 'type': "mustache", - 'result': "
                    \n", - }, - ], + 'type': 'mustache', + 'categories': [ + { + 'name': 'expand abbreviation', + 'tests': [ + { + 'name': "div#{{foo}}", + 'query': "div#{{foo}}", + 'type': "mustache", + 'result': "
                    \n", + }, + { + 'name': "div.{{foo}}", + 'query': "div.{{foo}}", + 'type': "mustache", + 'result': "
                    \n", + }, + ], + }, + ], }, ] " vim:set et: