123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159 |
- # Copyright (C) 2006, 2009 Alex Schroeder <alex@gnu.org>
- #
- # This program is free software; you can redistribute it and/or modify
- # it under the terms of the GNU General Public License as published by
- # the Free Software Foundation; either version 3 of the License, or
- # (at your option) any later version.
- #
- # This program is distributed in the hope that it will be useful,
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- # GNU General Public License for more details.
- #
- # You should have received a copy of the GNU General Public License
- # along with this program. If not, see <http://www.gnu.org/licenses/>.
- require 't/test.pl';
- package OddMuse;
- use Test::More tests => 60;
- update_page('InterMap', " OddMuse http://www.emacswiki.org/cgi-bin/oddmuse.pl?\n PlanetMath http://planetmath.org/encyclopedia/%s.html", 'required', 0, 1);
- # non links
- $NetworkFile = 1;
- $WikiLinks = 1;
- run_tests(split('\n',<<'EOT'));
- do not eat 0 from text
- do not eat 0 from text
- ordinary text
- ordinary text
- paragraph\n\nparagraph
- paragraph<p>paragraph</p>
- * one\n*two
- <ul><li>one *two</li></ul>
- * one\n\n*two
- <ul><li>one</li></ul><p>*two</p>
- * one\n** two
- <ul><li>one<ul><li>two</li></ul></li></ul>
- * one\n** two\n*** three\n* four
- <ul><li>one<ul><li>two<ul><li>three</li></ul></li></ul></li><li>four</li></ul>
- * one\n** two\n*** three\n* four\n** five\n* six
- <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>
- * one\n* two\n** one and two\n** two and three\n* three
- <ul><li>one</li><li>two<ul><li>one and two</li><li>two and three</li></ul></li><li>three</li></ul>
- * one and *\n* two and * more
- <ul><li>one and *</li><li>two and * more</li></ul>
- Foo::Bar
- Foo::Bar
- !WikiLink
- WikiLink
- !foo
- !foo
- file:///home/foo/tutorial.pdf
- file:///home/foo/tutorial.pdf
- named entities: >
- named entities: >
- garbage: &
- garbage: &
- numbered entity: {
- numbered entity: {
- numbered hex entity: ģ
- numbered hex entity: ģ
- named entity: ©
- named entity: ©
- quoted named entity: &copy;
- quoted named entity: &copy;
- case: Ä
- case: Ä
- EOT
- test_page(update_page('entity', 'quoted named entity: &copy;'),
- 'quoted named entity: &copy;');
- # links and other attributes containing attributes
- %Smilies = ('HAHA!' => '/pics/haha.png',
- '<3' => '/pics/heart.png',
- ':"\(' => '/pics/cat.png');
- xpath_run_tests(split('\n',<<'EOT'));
- HAHA!
- //img[@class="smiley"][@src="/pics/haha.png"][@alt="HAHA!"]
- i <3 you
- //img[@class="smiley"][@src="/pics/heart.png"][@alt="<3"]
- :"(
- //img[@class="smiley"][@src="/pics/cat.png"][@alt=':"(']
- WikiWord
- //a[@class="edit"][@title="Click to edit this page"][@href="http://localhost/test.pl?action=edit;id=WikiWord"][text()="?"]
- WikiWord:
- //a[@class="edit"][@title="Click to edit this page"][@href="http://localhost/test.pl?action=edit;id=WikiWord"][text()="?"]/following-sibling::text()[string()=":"]
- OddMuse
- //a[@class="edit"][@title="Click to edit this page"][@href="http://localhost/test.pl?action=edit;id=OddMuse"][text()="?"]
- OddMuse:
- //a[@class="edit"][@title="Click to edit this page"][@href="http://localhost/test.pl?action=edit;id=OddMuse"][text()="?"]/following-sibling::text()[string()=":"]
- OddMuse:test
- //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="interpage"][text()="test"]
- OddMuse:test: or not
- //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="interpage"][text()="test"]
- OddMuse:test, and foo
- //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="interpage"][text()="test"]
- PlanetMath:ZipfsLaw, and foo
- //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="interpage"][text()="ZipfsLaw"]
- [OddMuse:test]
- //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()="]"]
- ![[Free Link]]
- //a[@class="edit"][@title="Click to edit this page"][@href="http://localhost/test.pl?action=edit;id=Free_Link"][text()="?"]
- http://www.emacswiki.org
- //a[@class="url http"][@href="http://www.emacswiki.org"][text()="http://www.emacswiki.org"]
- <http://www.emacswiki.org>
- //text()[string()="<"]/following-sibling::a[@class="url http"][@href="http://www.emacswiki.org"][text()="http://www.emacswiki.org"]/following-sibling::text()[string()=">"]
- http://www.emacswiki.org/
- //a[@class="url http"][@href="http://www.emacswiki.org/"][text()="http://www.emacswiki.org/"]
- http://www.emacswiki.org.
- //a[@class="url http"][@href="http://www.emacswiki.org"][text()="http://www.emacswiki.org"]/following-sibling::text()[string()="."]
- http://www.emacswiki.org,
- //a[@class="url http"][@href="http://www.emacswiki.org"][text()="http://www.emacswiki.org"]/following-sibling::text()[string()=","]
- http://www.emacswiki.org;
- //a[@class="url http"][@href="http://www.emacswiki.org"][text()="http://www.emacswiki.org"]/following-sibling::text()[string()=";"]
- http://www.emacswiki.org:
- //a[@class="url http"][@href="http://www.emacswiki.org"][text()="http://www.emacswiki.org"]/following-sibling::text()[string()=":"]
- http://www.emacswiki.org?
- //a[@class="url http"][@href="http://www.emacswiki.org"][text()="http://www.emacswiki.org"]/following-sibling::text()[string()="?"]
- http://www.emacswiki.org/?
- //a[@class="url http"][@href="http://www.emacswiki.org/"][text()="http://www.emacswiki.org/"]/following-sibling::text()[string()="?"]
- http://www.emacswiki.org!
- //a[@class="url http"][@href="http://www.emacswiki.org"][text()="http://www.emacswiki.org"]/following-sibling::text()[string()="!"]
- http://www.emacswiki.org'
- //a[@class="url http"][@href="http://www.emacswiki.org"][text()="http://www.emacswiki.org"]/following-sibling::text()[string()="'"]
- http://www.emacswiki.org"
- //a[@class="url http"][@href="http://www.emacswiki.org"][text()="http://www.emacswiki.org"]/following-sibling::text()[string()='"']
- http://www.emacswiki.org!
- //a[@class="url http"][@href="http://www.emacswiki.org"][text()="http://www.emacswiki.org"]/following-sibling::text()[string()="!"]
- http://www.emacswiki.org(
- //a[@class="url http"][@href="http://www.emacswiki.org"][text()="http://www.emacswiki.org"]/following-sibling::text()[string()="("]
- http://www.emacswiki.org)
- //a[@class="url http"][@href="http://www.emacswiki.org"][text()="http://www.emacswiki.org"]/following-sibling::text()[string()=")"]
- http://www.emacswiki.org&
- //a[@class="url http"][@href="http://www.emacswiki.org"][text()="http://www.emacswiki.org"]/following-sibling::text()[string()="&"]
- http://www.emacswiki.org#
- //a[@class="url http"][@href="http://www.emacswiki.org"][text()="http://www.emacswiki.org"]/following-sibling::text()[string()="#"]
- http://www.emacswiki.org%
- //a[@class="url http"][@href="http://www.emacswiki.org"][text()="http://www.emacswiki.org"]/following-sibling::text()[string()="%"]
- [http://www.emacswiki.org]
- //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()="]"]
- [http://www.emacswiki.org] and [http://www.emacswiki.org]
- //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()="]"]
- [http://www.emacswiki.org],
- //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()="]"]
- [http://www.emacswiki.org and a label]
- //a[@class="url http outside"][@href="http://www.emacswiki.org"][text()="and a label"]
- [file://home/foo/tutorial.pdf local link]
- //a[@class="url file outside"][@href="file://home/foo/tutorial.pdf"][text()="local link"]
- file://home/foo/tutorial.pdf
- //a[@class="url file"][@href="file://home/foo/tutorial.pdf"][text()="file://home/foo/tutorial.pdf"]
- mailto:alex@emacswiki.org
- //a[@class="url mailto"][@href="mailto:alex@emacswiki.org"][text()="mailto:alex@emacswiki.org"]
- EOT
|