msva / lua-htmlparser

An HTML parser for lua.
234 stars 44 forks source link

Test script runs failed #59

Closed lucky2you closed 2 years ago

lucky2you commented 2 years ago

Run the script tst/init.lua, it reports failed.

lua-htmlparser/tst$ lua init.lua 
------------------------------------
Lua version: Lua 5.1
------------------------------------

Loaded testsuite with 16 tests in 1 testcases.

    .........F......

84 Assertions checked.

  1) Failure (html.test_void):
init.lua:41: expected 5 but was 1
init.lua:41: top level

Testsuite finished (15 passed, 1 failed, 0 errors, 0 skipped).
lucky2you commented 2 years ago

I add the testcase below, and it runs failed too.

function test_img()
    local tree = htmlparser.parse([[
        <e class="a b c" a="2-two">
        <img <%tpl%>></img>
        </e>
        <n b="222"></n>
    ]])
    assert_equal(2, #tree.nodes, "top level")
end

The output


lua-htmlparser/tst$ lua init.lua 
------------------------------------
Lua version: Lua 5.1
------------------------------------

Loaded testsuite with 17 tests in 1 testcases.

    F...F............

85 Assertions checked.

  1) Failure (html.test_void):
init.lua:41: expected 5 but was 1
init.lua:41: top level

  2) Failure (html.test_img):
init.lua:340: expected 2 but was 1
init.lua:340: top level

Testsuite finished (15 passed, 2 failed, 0 errors, 0 skipped).