File: 10_html2xmltext.t

package info (click to toggle)
libxml-rss-simplegen-perl 11.11-6
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, sid
  • size: 280 kB
  • sloc: perl: 1,230; makefile: 4
file content (87 lines) | stat: -rw-r--r-- 2,334 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87

require 5;
use strict;
use Test;
BEGIN { plan tests => 32 }

print "# Starting ", __FILE__ , " ...\n";
ok 1;

#sub XML::RSS::SimpleGen::DEBUG () {20}

use XML::RSS::SimpleGen;
print "# XML::RSS::SimpleGen version $XML::RSS::SimpleGen::VERSION\n";
sub z ($) { return XML::RSS::SimpleGen->html2text( $_[0] ) }

ok z ''      , ''  , 'nullstring';
ok z '1'     , '1' , 'digit 1';
ok z ' 1 '   , '1' , 'digit 1 with spaces';
ok z '    1 ', '1' , 'digit 1 with spaces';

ok z "vis--vis Beyonc's nave papier-mch rsum",
     "vis-à-vis Beyoncé's naïve papier-mâché résumé";

ok z "vis-à-vis Beyoncé's naïve papier-mâché résumé",
     "vis-à-vis Beyoncé's naïve papier-mâché résumé";

ok z "上德不德,",
     "上德不德,";

ok z "上德不 德 ,",
     "上德不 德 ,";

ok z "上丸,",
     "上丸,";

ok z "上丸,",
     "上丸,";

ok z "&#x4E0a;<!-- yorp -->&#x2f801;&#xFF0c;",
     "&#x4E0a;&#x2f801;&#xFF0c;";


print "# De-Winification test:\n";
ok z "20 could be fun - No-body",
     '&#8364;20 &#8216;could&#8217; be &#8220;fun&#8221; - No-body';
ok z "p&#146;yogo!",   "p&#8217;yogo!";
ok z "p&#0146;yogo!",  "p&#8217;yogo!";
ok z "p&#x92;yogo!",   "p&#8217;yogo!";
ok z "p&#x092;yogo!",  "p&#8217;yogo!";



print "# Tag tests...\n";

ok z "N < 17 => true", 
     "N &lt; 17 =&gt; true";

ok z "Realtime", 
     "Realtime";
ok z "Real<p>time", 
     "Real time";
ok z "Real</p>time", 
     "Real time";
ok z "Real<br>time", 
     "Real time";
ok z "Real<hr>time", 
     "Real time";
ok z "Real<p class='bazouki' thing=\"lalala\">time", 
     "Real time";
ok z "Real<b>time", 
     "Realtime";
ok z "Real<!-- yow -->time",
     "Realtime";
ok z "Real<squim class='bazouki' thing=\"lalala\">time", 
     "Realtime";
ok z "Real<squim class='bazouki' thing=\"lalala\" />time", 
     "Realtime";
ok z "Real<squim class='bazouki' thing=\"lalala\" />time", 
     "Realtime";
ok z "Real\n\n\n\n\n        \t\t time", 
     "Real time";
ok z "Real<span\n\n\n\n\n        \t\t >time", 
     "Realtime";

print "# Quitting...\n";
ok 1;