From f97cde994e98c290b5086d1976ee27696a65b753 Mon Sep 17 00:00:00 2001 From: Wouter Scherphof Date: Tue, 2 Apr 2013 12:13:23 +0200 Subject: [PATCH] Separated tests for descendants and children. Fixes #17 --- tst/init.lua | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/tst/init.lua b/tst/init.lua index fe62536..fc80b37 100644 --- a/tst/init.lua +++ b/tst/init.lua @@ -6,9 +6,9 @@ local lunitx = require("lunitx") module("html", lunitx.testcase, package.seeall) local htmlparser = require("htmlparser") +local tree, sel -function test_children() - local tree, sel +function test_descendants() tree = htmlparser.parse([[ 1 1.1 @@ -25,6 +25,23 @@ function test_children() ]]) sel = tree("parent child") assert_equal(6, sel:len(), 'parent child') +end + +function test_children() + tree = htmlparser.parse([[ + 1 + 1.1 + 1.2 + 1.2.1 + + + 2 + 2.1 + 2.2 + 2.2.1 + + + ]]) sel = tree("parent > child") assert_equal(4, sel:len(), 'parent > child') end \ No newline at end of file