Removed tests from sample.lua

This commit is contained in:
Wouter Scherphof 2013-04-05 20:03:04 +02:00
parent 2983056fa2
commit 7c7b4b2f42
2 changed files with 4 additions and 53 deletions

View File

@ -76,7 +76,10 @@ Selectors can be combined; e.g. `".class:not([attribute]) element.class"`
- The HTML text is not validated in any way; tag and attribute names and the nesting of different tags is completely arbitrary. The only HTML-specific part of the parser is that it knows which tags are void elements - The HTML text is not validated in any way; tag and attribute names and the nesting of different tags is completely arbitrary. The only HTML-specific part of the parser is that it knows which tags are void elements
##Examples ##Examples
See `./doc/samples.lua` See `./doc/sample.lua`
##Tests
See `./tst/init.lua`
##Element type ##Element type
All tree elements provide, apart from `:select` and `()`, the following accessors: All tree elements provide, apart from `:select` and `()`, the following accessors:

View File

@ -23,58 +23,6 @@ local function p(n)
end end
p(root) p(root)
local function select( s )
print ""
print("->", s)
local sel = root:select(s)
for element in pairs(sel) do
print(element.name)
end
print(sel:len())
end
select("*")
select("link")
select("#/contacts/4711")
select(".chapters")
select("[href]")
select("span.firstname")
select("ul[id]")
select("#/contacts/4711")
select("#/contacts/4711 *")
select("#/contacts/4711 .lastname")
select("body li[id]")
select("ul")
select("ul *")
select("ul > *")
select("body [class]")
select("body > [class]")
select(".contacts span:not(.firstname)")
select(":not(a)[href]")
select("[itemscope]:not([itemprop])")
select("link[rel='alternate']")
select("[test2=\"val='2'\"]")
select("[test5='val5']")
select("[test6='val\"\"6']")
select("[itemscope='']")
select("[itemscope=]")
select("[itemscope]")
select("[itemscope][itemprop='address']")
select("[itemscope][itemprop!='address']")
select("[itemscope][itemprop!='adres']")
select("[itemscope][itemprop!='']")
select("[hreflang|='en']")
select("[itemprop*='address']")
select("[words~='two']")
select("[words~='three']")
select("[itemprop$='ion']")
select("[hreflang^='en']")
print("\nchapters") print("\nchapters")
local sel, chapters = root("ol.chapters > li"), {} local sel, chapters = root("ol.chapters > li"), {}
for e in pairs(sel) do for e in pairs(sel) do