4 use Test::More tests => 3;
9 my $cdata = shift() ? "CDATA" : "TEXT";
10 my($offset, $line, $col, $t) = @_;
11 $text .= "[$cdata:$offset:$line.$col:$t]";
19 my $p = HTML::Parser->new(unbroken_text => 1,
20 text_h => [\&text, "is_cdata,offset,line,column,text"],
21 start_h => [\&tag, "text"],
22 end_h => [\&tag, "text"],
30 $p->parse("<xmp>xmp</xmp>");
34 is($text, "[TEXT:0:1.0:foo bar ]<foo>[TEXT:13:1.13:bar\n]</foo><xmp>[CDATA:28:2.11:xmp]</xmp>");
40 is($text, "[TEXT:37:2.20:atend]");
43 $p = HTML::Parser->new(unbroken_text => 1,
44 text_h => [\&text, "is_cdata,offset,line,column,text"],
58 is($text, "[TEXT:0:1.0:foobar\nfoo][CDATA:20:2.8:xmp][TEXT:29:2.17:bar]");