HTML::Util: Tests, und Bugfixes für ein paar Randbedingungen
[kivitendo-erp.git] / t / html / util.t
1 use Test::More;
2
3 use_ok 'SL::HTML::Util';
4
5 sub test {
6   is(SL::HTML::Util::strip($_[0]), $_[1], "$_[2] (direct invocation)");
7   is(SL::HTML::Util->strip($_[0]), $_[1], "$_[2] (class invocation)");
8 }
9
10 test undef, '', 'undef';
11 test 0, '0', '0';
12 test '0 but true', '0 but true', 'zero but true';
13 test '<h1>title</h1>', 'title', 'standard case';
14 test '<h1>title</h2>', 'title', 'imbalanced html';
15 test 'walter &amp; walter', 'walter & walter', 'known entities';
16 test 'Walter&Walter; Chicago', 'Walter&Walter; Chicago', 'unknown entities';
17 test '<h1>title</h1', 'title', 'invalid html 1';
18
19 # This happens when someone copies a block from MS Word. The HTML that is
20 # generated contains style information in comments. These styles can contain
21 # sgml. HTML::Parser does not handle these properly.
22 test '<!-- style: <>  -->title', 'title', 'nested stuff in html comments';
23
24 done_testing;