1 # Copyright (C) 2006, 2009 Alex Schroeder <alex@gnu.org>
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 use Test::More tests => 60;
22 update_page('InterMap', " OddMuse http://www.emacswiki.org/cgi-bin/oddmuse.pl?\n PlanetMath http://planetmath.org/encyclopedia/%s.html", 'required', 0, 1);
28 run_tests(split('\n',<<'EOT'));
29 do not eat 0 from text
30 do not eat 0 from text
33 paragraph\n\nparagraph
34 paragraph<p>paragraph</p>
36 <ul><li>one *two</li></ul>
38 <ul><li>one</li></ul><p>*two</p>
40 <ul><li>one<ul><li>two</li></ul></li></ul>
41 * one\n** two\n*** three\n* four
42 <ul><li>one<ul><li>two<ul><li>three</li></ul></li></ul></li><li>four</li></ul>
43 * one\n** two\n*** three\n* four\n** five\n* six
44 <ul><li>one<ul><li>two<ul><li>three</li></ul></li></ul></li><li>four<ul><li>five</li></ul></li><li>six</li></ul>
45 * one\n* two\n** one and two\n** two and three\n* three
46 <ul><li>one</li><li>two<ul><li>one and two</li><li>two and three</li></ul></li><li>three</li></ul>
47 * one and *\n* two and * more
48 <ul><li>one and *</li><li>two and * more</li></ul>
55 file:///home/foo/tutorial.pdf
56 file:///home/foo/tutorial.pdf
61 numbered entity: {
62 numbered entity: {
63 numbered hex entity: ģ
64 numbered hex entity: ģ
67 quoted named entity: &copy;
68 quoted named entity: &copy;
73 test_page(update_page('entity', 'quoted named entity: &copy;'),
74 'quoted named entity: &copy;');
76 # links and other attributes containing attributes
78 %Smilies = ('HAHA!' => '/pics/haha.png',
79 '<3' => '/pics/heart.png',
80 ':"\(' => '/pics/cat.png');
82 xpath_run_tests(split('\n',<<'EOT'));
84 //img[@class="smiley"][@src="/pics/haha.png"][@alt="HAHA!"]
86 //img[@class="smiley"][@src="/pics/heart.png"][@alt="<3"]
88 //img[@class="smiley"][@src="/pics/cat.png"][@alt=':"(']
90 //a[@class="edit"][@title="Click to edit this page"][@href="http://localhost/test.pl?action=edit;id=WikiWord"][text()="?"]
92 //a[@class="edit"][@title="Click to edit this page"][@href="http://localhost/test.pl?action=edit;id=WikiWord"][text()="?"]/following-sibling::text()[string()=":"]
94 //a[@class="edit"][@title="Click to edit this page"][@href="http://localhost/test.pl?action=edit;id=OddMuse"][text()="?"]
96 //a[@class="edit"][@title="Click to edit this page"][@href="http://localhost/test.pl?action=edit;id=OddMuse"][text()="?"]/following-sibling::text()[string()=":"]
98 //a[@class="inter OddMuse"][@href="http://www.emacswiki.org/cgi-bin/oddmuse.pl?test"]/span[@class="site"][text()="OddMuse"]/following-sibling::span[@class="separator"][text()=":"]/following-sibling::span[@class="page"][text()="test"]
100 //a[@class="inter OddMuse"][@href="http://www.emacswiki.org/cgi-bin/oddmuse.pl?test"]/span[@class="site"][text()="OddMuse"]/following-sibling::span[@class="separator"][text()=":"]/following-sibling::span[@class="page"][text()="test"]
101 OddMuse:test, and foo
102 //a[@class="inter OddMuse"][@href="http://www.emacswiki.org/cgi-bin/oddmuse.pl?test"]/span[@class="site"][text()="OddMuse"]/following-sibling::span[@class="separator"][text()=":"]/following-sibling::span[@class="page"][text()="test"]
103 PlanetMath:ZipfsLaw, and foo
104 //a[@class="inter PlanetMath"][@href="http://planetmath.org/encyclopedia/ZipfsLaw.html"]/span[@class="site"][text()="PlanetMath"]/following-sibling::span[@class="separator"][text()=":"]/following-sibling::span[@class="page"][text()="ZipfsLaw"]
106 //a[@class="inter OddMuse number"][@href="http://www.emacswiki.org/cgi-bin/oddmuse.pl?test"]/span/span[@class="bracket"][text()="["]/following-sibling::text()[string()="1"]/following-sibling::span[@class="bracket"][text()="]"]
108 //a[@class="edit"][@title="Click to edit this page"][@href="http://localhost/test.pl?action=edit;id=Free_Link"][text()="?"]
109 http://www.emacswiki.org
110 //a[@class="url http"][@href="http://www.emacswiki.org"][text()="http://www.emacswiki.org"]
111 <http://www.emacswiki.org>
112 //text()[string()="<"]/following-sibling::a[@class="url http"][@href="http://www.emacswiki.org"][text()="http://www.emacswiki.org"]/following-sibling::text()[string()=">"]
113 http://www.emacswiki.org/
114 //a[@class="url http"][@href="http://www.emacswiki.org/"][text()="http://www.emacswiki.org/"]
115 http://www.emacswiki.org.
116 //a[@class="url http"][@href="http://www.emacswiki.org"][text()="http://www.emacswiki.org"]/following-sibling::text()[string()="."]
117 http://www.emacswiki.org,
118 //a[@class="url http"][@href="http://www.emacswiki.org"][text()="http://www.emacswiki.org"]/following-sibling::text()[string()=","]
119 http://www.emacswiki.org;
120 //a[@class="url http"][@href="http://www.emacswiki.org"][text()="http://www.emacswiki.org"]/following-sibling::text()[string()=";"]
121 http://www.emacswiki.org:
122 //a[@class="url http"][@href="http://www.emacswiki.org"][text()="http://www.emacswiki.org"]/following-sibling::text()[string()=":"]
123 http://www.emacswiki.org?
124 //a[@class="url http"][@href="http://www.emacswiki.org"][text()="http://www.emacswiki.org"]/following-sibling::text()[string()="?"]
125 http://www.emacswiki.org/?
126 //a[@class="url http"][@href="http://www.emacswiki.org/"][text()="http://www.emacswiki.org/"]/following-sibling::text()[string()="?"]
127 http://www.emacswiki.org!
128 //a[@class="url http"][@href="http://www.emacswiki.org"][text()="http://www.emacswiki.org"]/following-sibling::text()[string()="!"]
129 http://www.emacswiki.org'
130 //a[@class="url http"][@href="http://www.emacswiki.org"][text()="http://www.emacswiki.org"]/following-sibling::text()[string()="'"]
131 http://www.emacswiki.org"
132 //a[@class="url http"][@href="http://www.emacswiki.org"][text()="http://www.emacswiki.org"]/following-sibling::text()[string()='"']
133 http://www.emacswiki.org!
134 //a[@class="url http"][@href="http://www.emacswiki.org"][text()="http://www.emacswiki.org"]/following-sibling::text()[string()="!"]
135 http://www.emacswiki.org(
136 //a[@class="url http"][@href="http://www.emacswiki.org"][text()="http://www.emacswiki.org"]/following-sibling::text()[string()="("]
137 http://www.emacswiki.org)
138 //a[@class="url http"][@href="http://www.emacswiki.org"][text()="http://www.emacswiki.org"]/following-sibling::text()[string()=")"]
139 http://www.emacswiki.org&
140 //a[@class="url http"][@href="http://www.emacswiki.org"][text()="http://www.emacswiki.org"]/following-sibling::text()[string()="&"]
141 http://www.emacswiki.org#
142 //a[@class="url http"][@href="http://www.emacswiki.org"][text()="http://www.emacswiki.org"]/following-sibling::text()[string()="#"]
143 http://www.emacswiki.org%
144 //a[@class="url http"][@href="http://www.emacswiki.org"][text()="http://www.emacswiki.org"]/following-sibling::text()[string()="%"]
145 [http://www.emacswiki.org]
146 //a[@class="url http number"][@href="http://www.emacswiki.org"]/span/span[@class="bracket"][text()="["]/following-sibling::text()[string()="1"]/following-sibling::span[@class="bracket"][text()="]"]
147 [http://www.emacswiki.org] and [http://www.emacswiki.org]
148 //a[@class="url http number"][@href="http://www.emacswiki.org"]/span/span[@class="bracket"][text()="["]/following-sibling::text()[string()="1"]/following-sibling::span[@class="bracket"][text()="]"]/../../following-sibling::text()[string()=" and "]/following-sibling::a[@class="url http number"][@href="http://www.emacswiki.org"]/span/span[@class="bracket"][text()="["]/following-sibling::text()[string()="2"]/following-sibling::span[@class="bracket"][text()="]"]
149 [http://www.emacswiki.org],
150 //a[@class="url http number"][@href="http://www.emacswiki.org"]/span/span[@class="bracket"][text()="["]/following-sibling::text()[string()="1"]/following-sibling::span[@class="bracket"][text()="]"]
151 [http://www.emacswiki.org and a label]
152 //a[@class="url http outside"][@href="http://www.emacswiki.org"][text()="and a label"]
153 [file://home/foo/tutorial.pdf local link]
154 //a[@class="url file outside"][@href="file://home/foo/tutorial.pdf"][text()="local link"]
155 file://home/foo/tutorial.pdf
156 //a[@class="url file"][@href="file://home/foo/tutorial.pdf"][text()="file://home/foo/tutorial.pdf"]
157 mailto:alex@emacswiki.org
158 //a[@class="url mailto"][@href="mailto:alex@emacswiki.org"][text()="mailto:alex@emacswiki.org"]