forked from github/kensanata.oddmuse
Moved tests here from ../test.pl
This commit is contained in:
128
t/default-links.pl
Executable file
128
t/default-links.pl
Executable file
@@ -0,0 +1,128 @@
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 53;
|
||||
|
||||
clear_pages();
|
||||
|
||||
$AllNetworkFiles = 1;
|
||||
|
||||
update_page('HomePage', "This page exists.");
|
||||
update_page('InterMap', " Oddmuse http://www.emacswiki.org/cgi-bin/oddmuse.pl?\n PlanetMath http://planetmath.org/encyclopedia/%s.html", 'required', 0, 1);
|
||||
$InterInit = 0;
|
||||
$BracketWiki = 0; # old default
|
||||
InitVariables();
|
||||
|
||||
xpath_run_tests(split('\n',<<'EOT'));
|
||||
file://home/foo/tutorial.pdf
|
||||
//a[@class="url file"][@href="file://home/foo/tutorial.pdf"][text()="file://home/foo/tutorial.pdf"]
|
||||
file:///home/foo/tutorial.pdf
|
||||
//a[@class="url file"][@href="file:///home/foo/tutorial.pdf"][text()="file:///home/foo/tutorial.pdf"]
|
||||
image inline: [[image:HomePage]]
|
||||
//a[@class="image"][@href="http://localhost/test.pl/HomePage"]/img[@class="upload"][@src="http://localhost/test.pl/download/HomePage"][@alt="HomePage"]
|
||||
image inline: [[image:OtherPage]]
|
||||
//a[@class="edit"][@title="Click to edit this page"][@href="http://localhost/test.pl?action=edit;id=OtherPage;upload=1"][text()="?"]
|
||||
traditional local link: HomePage
|
||||
//a[@class="local"][@href="http://localhost/test.pl/HomePage"][text()="HomePage"]
|
||||
traditional local link: OtherPage
|
||||
//a[@class="edit"][@title="Click to edit this page"][@href="http://localhost/test.pl?action=edit;id=OtherPage"][text()="?"]
|
||||
traditional local link with extra brackets: [HomePage]
|
||||
//a[@class="local number"][@title="HomePage"][@href="http://localhost/test.pl/HomePage"]/span/span[@class="bracket"][text()="["]/following-sibling::text()[string()="1"]/following-sibling::span[@class="bracket"][text()="]"]
|
||||
traditional local link with extra brackets: [OtherPage]
|
||||
//a[@class="edit"][@title="Click to edit this page"][@href="http://localhost/test.pl?action=edit;id=OtherPage"][text()="?"]
|
||||
traditional local link with other text: [HomePage homepage]
|
||||
//a[@class="local"][@href="http://localhost/test.pl/HomePage"][text()="HomePage"]
|
||||
traditional local link with other text: [OtherPage other page]
|
||||
//a[@class="edit"][@title="Click to edit this page"][@href="http://localhost/test.pl?action=edit;id=OtherPage"][text()="?"]
|
||||
free link: [[home page]]
|
||||
//a[@class="edit"][@title="Click to edit this page"][@href="http://localhost/test.pl?action=edit;id=home_page"][text()="?"]
|
||||
free link: [[other page]]
|
||||
//a[@class="edit"][@title="Click to edit this page"][@href="http://localhost/test.pl?action=edit;id=other_page"][text()="?"]
|
||||
free link with extra brackets: [[[home page]]]
|
||||
//a[@class="edit"][@title="Click to edit this page"][@href="http://localhost/test.pl?action=edit;id=home_page"][text()="?"]
|
||||
free link with extra brackets: [[[other page]]]
|
||||
//a[@class="edit"][@title="Click to edit this page"][@href="http://localhost/test.pl?action=edit;id=other_page"][text()="?"]
|
||||
free link with other text: [[home page|da homepage]]
|
||||
//text()[string()="free link with other text: [[home page|da homepage]]"]
|
||||
free link with other text: [[other page|da other homepage]]
|
||||
//text()[string()="free link with other text: [[other page|da other homepage]]"]
|
||||
URL: http://www.oddmuse.org/
|
||||
//a[@class="url http"][@href="http://www.oddmuse.org/"][text()="http://www.oddmuse.org/"]
|
||||
URL in text http://www.oddmuse.org/ like this
|
||||
//text()[string()="URL in text "]/following-sibling::a[@class="url http"][@href="http://www.oddmuse.org/"][text()="http://www.oddmuse.org/"]/following-sibling::text()[string()=" like this"]
|
||||
URL in brackets: [http://www.oddmuse.org/]
|
||||
//a[@class="url http number"][@href="http://www.oddmuse.org/"]/span/span[@class="bracket"][text()="["]/following-sibling::text()[string()="1"]/following-sibling::span[@class="bracket"][text()="]"]
|
||||
URL in brackets with other text: [http://www.oddmuse.org/ oddmuse]
|
||||
//a[@class="url http outside"][@href="http://www.oddmuse.org/"][text()="oddmuse"]
|
||||
URL abbreviation: Oddmuse:Link_Pattern
|
||||
//a[@class="inter Oddmuse"][@href="http://www.emacswiki.org/cgi-bin/oddmuse.pl?Link_Pattern"]/span[@class="site"][text()="Oddmuse"]/following-sibling::text()[string()=":"]/following-sibling::span[@class="page"][text()="Link_Pattern"]
|
||||
URL abbreviation with extra brackets: [Oddmuse:Link_Pattern]
|
||||
//a[@class="inter Oddmuse number"][@href="http://www.emacswiki.org/cgi-bin/oddmuse.pl?Link_Pattern"]/span/span[@class="bracket"][text()="["]/following-sibling::text()[string()="1"]/following-sibling::span[@class="bracket"][text()="]"]
|
||||
URL abbreviation with other text: [Oddmuse:Link_Pattern link patterns]
|
||||
//a[@class="inter Oddmuse outside"][@href="http://www.emacswiki.org/cgi-bin/oddmuse.pl?Link_Pattern"][text()="link patterns"]
|
||||
URL abbreviation with meta characters: Oddmuse:Link+Pattern
|
||||
//a[@class="inter Oddmuse"][@href="http://www.emacswiki.org/cgi-bin/oddmuse.pl?Link+Pattern"]/span[@class="site"][text()="Oddmuse"]/following-sibling::text()[string()=":"]/following-sibling::span[@class="page"][text()="Link+Pattern"]
|
||||
URL abbreviation with meta characters and extra brackets: [Oddmuse:Link+Pattern]
|
||||
//a[@class="inter Oddmuse number"][@href="http://www.emacswiki.org/cgi-bin/oddmuse.pl?Link+Pattern"]/span/span[@class="bracket"][text()="["]/following-sibling::text()[string()="1"]/following-sibling::span[@class="bracket"][text()="]"]
|
||||
URL abbreviation with meta characters and other text: [Oddmuse:Link+Pattern link patterns]
|
||||
//a[@class="inter Oddmuse outside"][@href="http://www.emacswiki.org/cgi-bin/oddmuse.pl?Link+Pattern"][text()="link patterns"]
|
||||
free URL abbreviation: [[Oddmuse:Link Pattern]]
|
||||
//a[@class="inter Oddmuse"][@href="http://www.emacswiki.org/cgi-bin/oddmuse.pl?Link%20Pattern"]/span[@class="site"][text()="Oddmuse"]/following-sibling::text()[string()=":"]/following-sibling::span[@class="page"][text()="Link Pattern"]
|
||||
free URL abbreviation with extra brackets: [[[Oddmuse:Link Pattern]]]
|
||||
//a[@class="inter Oddmuse number"][@href="http://www.emacswiki.org/cgi-bin/oddmuse.pl?Link%20Pattern"]/span/span[@class="bracket"][text()="["]/following-sibling::text()[string()="1"]/following-sibling::span[@class="bracket"][text()="]"]
|
||||
free URL abbreviation with other text: [[Oddmuse:Link Pattern|link patterns]]
|
||||
//a[@class="inter Oddmuse outside"][@href="http://www.emacswiki.org/cgi-bin/oddmuse.pl?Link%20Pattern"][text()="link patterns"]
|
||||
free URL abbreviation with meta characters: [[Oddmuse:Link+Pattern]]
|
||||
//a[@class="inter Oddmuse"][@href="http://www.emacswiki.org/cgi-bin/oddmuse.pl?Link%2bPattern"]/span[@class="site"][text()="Oddmuse"]/following-sibling::text()[string()=":"]/following-sibling::span[@class="page"][text()="Link+Pattern"]
|
||||
free URL abbreviation with meta characters and extra brackets: [[[Oddmuse:Link+Pattern]]]
|
||||
//a[@class="inter Oddmuse number"][@href="http://www.emacswiki.org/cgi-bin/oddmuse.pl?Link%2bPattern"]/span/span[@class="bracket"][text()="["]/following-sibling::text()[string()="1"]/following-sibling::span[@class="bracket"][text()="]"]
|
||||
free URL abbreviation with meta characters and other text: [[Oddmuse:Link+Pattern|link patterns]]
|
||||
//a[@class="inter Oddmuse outside"][@href="http://www.emacswiki.org/cgi-bin/oddmuse.pl?Link%2bPattern"][text()="link patterns"]
|
||||
EOT
|
||||
|
||||
$AllNetworkFiles = 0;
|
||||
$BracketWiki = 1;
|
||||
|
||||
xpath_run_tests(split('\n',<<'EOT'));
|
||||
traditional local link: HomePage
|
||||
//a[@class="local"][@href="http://localhost/test.pl/HomePage"][text()="HomePage"]
|
||||
traditional local link: OtherPage
|
||||
//a[@class="edit"][@title="Click to edit this page"][@href="http://localhost/test.pl?action=edit;id=OtherPage"][text()="?"]
|
||||
traditional local link with extra brackets: [HomePage]
|
||||
//a[@class="local number"][@title="HomePage"][@href="http://localhost/test.pl/HomePage"]/span/span[@class="bracket"][text()="["]/following-sibling::text()[string()="1"]/following-sibling::span[@class="bracket"][text()="]"]
|
||||
traditional local link with extra brackets: [OtherPage]
|
||||
//a[@class="edit"][@title="Click to edit this page"][@href="http://localhost/test.pl?action=edit;id=OtherPage"][text()="?"]
|
||||
traditional local link with other text: [HomePage homepage]
|
||||
//a[@class="local"][@href="http://localhost/test.pl/HomePage"][text()="homepage"]
|
||||
traditional local link with other text: [OtherPage other page]
|
||||
//a[@class="edit"][@title="Click to edit this page"][@href="http://localhost/test.pl?action=edit;id=OtherPage"][text()="?"]
|
||||
free link: [[home page]]
|
||||
//a[@class="edit"][@title="Click to edit this page"][@href="http://localhost/test.pl?action=edit;id=home_page"][text()="?"]
|
||||
free link: [[other page]]
|
||||
//a[@class="edit"][@title="Click to edit this page"][@href="http://localhost/test.pl?action=edit;id=other_page"][text()="?"]
|
||||
free link with extra brackets: [[[home page]]]
|
||||
//a[@class="edit"][@title="Click to edit this page"][@href="http://localhost/test.pl?action=edit;id=home_page"][text()="?"]
|
||||
free link with extra brackets: [[[other page]]]
|
||||
//a[@class="edit"][@title="Click to edit this page"][@href="http://localhost/test.pl?action=edit;id=other_page"][text()="?"]
|
||||
free link with other text: [[home page|da homepage]]
|
||||
//a[@class="edit"][@title="Click to edit this page"][@href="http://localhost/test.pl?action=edit;id=home_page"][text()="?"]
|
||||
free link with other text: [[other page|da other homepage]]
|
||||
//a[@class="edit"][@title="Click to edit this page"][@href="http://localhost/test.pl?action=edit;id=other_page"][text()="?"]
|
||||
URL: http://www.oddmuse.org/
|
||||
//a[@class="url http"][@href="http://www.oddmuse.org/"][text()="http://www.oddmuse.org/"]
|
||||
URL in brackets: [http://www.oddmuse.org/]
|
||||
//a[@class="url http number"][@href="http://www.oddmuse.org/"]/span/span[@class="bracket"][text()="["]/following-sibling::text()[string()="1"]/following-sibling::span[@class="bracket"][text()="]"]
|
||||
URL in brackets with other text: [http://www.oddmuse.org/ oddmuse]
|
||||
//a[@class="url http outside"][@href="http://www.oddmuse.org/"][text()="oddmuse"]
|
||||
URL abbreviation: Oddmuse:Link_Pattern
|
||||
//a[@class="inter Oddmuse"][@href="http://www.emacswiki.org/cgi-bin/oddmuse.pl?Link_Pattern"]/span[@class="site"][text()="Oddmuse"]/following-sibling::text()[string()=":"]/following-sibling::span[@class="page"][text()="Link_Pattern"]
|
||||
URL abbreviation with extra brackets: [Oddmuse:Link_Pattern]
|
||||
//a[@class="inter Oddmuse number"][@href="http://www.emacswiki.org/cgi-bin/oddmuse.pl?Link_Pattern"]/span/span[@class="bracket"][text()="["]/following-sibling::text()[string()="1"]/following-sibling::span[@class="bracket"][text()="]"]
|
||||
URL abbreviation with other text: [Oddmuse:Link_Pattern link patterns]
|
||||
//a[@class="inter Oddmuse outside"][@href="http://www.emacswiki.org/cgi-bin/oddmuse.pl?Link_Pattern"][text()="link patterns"]
|
||||
free URL abbreviation: [[Oddmuse:Link Pattern]]
|
||||
//a[@class="inter Oddmuse"][@href="http://www.emacswiki.org/cgi-bin/oddmuse.pl?Link%20Pattern"]/span[@class="site"][text()="Oddmuse"]/following-sibling::text()[string()=":"]/following-sibling::span[@class="page"][text()="Link Pattern"]
|
||||
free URL abbreviation with extra brackets: [[[Oddmuse:Link Pattern]]]
|
||||
//a[@class="inter Oddmuse number"][@href="http://www.emacswiki.org/cgi-bin/oddmuse.pl?Link%20Pattern"]/span/span[@class="bracket"][text()="["]/following-sibling::text()[string()="1"]/following-sibling::span[@class="bracket"][text()="]"]
|
||||
free URL abbreviation with other text: [[Oddmuse:Link Pattern|link pattern]]
|
||||
//a[@class="inter Oddmuse outside"][@href="http://www.emacswiki.org/cgi-bin/oddmuse.pl?Link%20Pattern"][text()="link pattern"]
|
||||
EOT
|
||||
32
t/usemod-options.t
Executable file
32
t/usemod-options.t
Executable file
@@ -0,0 +1,32 @@
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 7;
|
||||
|
||||
clear_pages();
|
||||
|
||||
add_module('usemod.pl');
|
||||
|
||||
InitVariables();
|
||||
|
||||
$UseModSpaceRequired = 0;
|
||||
$UseModMarkupInTitles = 1;
|
||||
|
||||
run_tests(split('\n',<<'EOT'));
|
||||
*one\n**two
|
||||
<ul><li>one<ul><li>two</li></ul></li></ul>
|
||||
#one\n##two
|
||||
<ol><li>one<ol><li>two</li></ol></li></ol>
|
||||
:one\n:two\n::one and two\n::two and three\n:three
|
||||
<dl class="quote"><dt /><dd>one</dd><dt /><dd>two<dl class="quote"><dt /><dd>one and two</dd><dt /><dd>two and three</dd></dl></dd><dt /><dd>three</dd></dl>
|
||||
;one:eins\n;two:zwei
|
||||
<dl><dt>one</dt><dd>eins</dd><dt>two</dt><dd>zwei</dd></dl>
|
||||
=='''title'''==
|
||||
<h2><strong>title</strong></h2>
|
||||
1 \+ 1 = 2
|
||||
1 \+ 1 = 2
|
||||
EOT
|
||||
|
||||
xpath_run_tests(split('\n',<<'EOT'));
|
||||
==[[Free Link]]==
|
||||
//h2/text()[string()="[Free Link]"]/following-sibling::a[@class="edit"][@title="Click to edit this page"][@href="http://localhost/test.pl?action=edit;id=Free_Link"][text()="?"]
|
||||
EOT
|
||||
98
t/usemod.t
Executable file
98
t/usemod.t
Executable file
@@ -0,0 +1,98 @@
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 43;
|
||||
|
||||
clear_pages();
|
||||
|
||||
add_module('usemod.pl');
|
||||
|
||||
InitVariables();
|
||||
|
||||
run_tests(split('\n',<<'EOT'));
|
||||
* ''one\n** two
|
||||
<ul><li><em>one</em><ul><li>two</li></ul></li></ul>
|
||||
# one\n# two
|
||||
<ol><li>one</li><li>two</li></ol>
|
||||
* one\n# two
|
||||
<ul><li>one</li></ul><ol><li>two</li></ol>
|
||||
# one\n\n#two
|
||||
<ol><li>one</li></ol><p>#two</p>
|
||||
# one\n# two\n## one and two\n## two and three\n# three
|
||||
<ol><li>one</li><li>two<ol><li>one and two</li><li>two and three</li></ol></li><li>three</li></ol>
|
||||
# one and #\n# two and # more
|
||||
<ol><li>one and #</li><li>two and # more</li></ol>
|
||||
: one\n: two\n:: one and two\n:: two and three\n: three
|
||||
<dl class="quote"><dt /><dd>one</dd><dt /><dd>two<dl class="quote"><dt /><dd>one and two</dd><dt /><dd>two and three</dd></dl></dd><dt /><dd>three</dd></dl>
|
||||
: one and :)\n: two and :) more
|
||||
<dl class="quote"><dt /><dd>one and :)</dd><dt /><dd>two and :) more</dd></dl>
|
||||
: one\n\n:two
|
||||
<dl class="quote"><dt /><dd>one</dd></dl><p>:two</p>
|
||||
; one:eins\n;two:zwei
|
||||
<dl><dt>one</dt><dd>eins ;two:zwei</dd></dl>
|
||||
; one:eins\n\n; two:zwei
|
||||
<dl><dt>one</dt><dd>eins</dd><dt>two</dt><dd>zwei</dd></dl>
|
||||
; a: b: c\n;; x: y: z
|
||||
<dl><dt>a</dt><dd>b: c<dl><dt>x</dt><dd>y: z</dd></dl></dd></dl>
|
||||
* foo <b>bold\n* bar </b>
|
||||
<ul><li>foo <b>bold</b></li><li>bar </b></li></ul>
|
||||
This is ''emphasized''.
|
||||
This is <em>emphasized</em>.
|
||||
This is '''strong'''.
|
||||
This is <strong>strong</strong>.
|
||||
This is ''longer emphasized'' text.
|
||||
This is <em>longer emphasized</em> text.
|
||||
This is '''longer strong''' text.
|
||||
This is <strong>longer strong</strong> text.
|
||||
This is '''''emphasized and bold''''' text.
|
||||
This is <strong><em>emphasized and bold</em></strong> text.
|
||||
This is ''emphasized '''and bold''''' text.
|
||||
This is <em>emphasized <strong>and bold</strong></em> text.
|
||||
This is '''bold ''and emphasized''''' text.
|
||||
This is <strong>bold <em>and emphasized</em></strong> text.
|
||||
This is ''emphasized text containing '''longer strong''' text''.
|
||||
This is <em>emphasized text containing <strong>longer strong</strong> text</em>.
|
||||
This is '''strong text containing ''emph'' text'''.
|
||||
This is <strong>strong text containing <em>emph</em> text</strong>.
|
||||
||one||
|
||||
<table class="user"><tr><td>one</td></tr></table>
|
||||
||one||
|
||||
<table class="user"><tr><td>one</td><td align="left"> </td></tr></table>
|
||||
|| one ''two'' ||
|
||||
<table class="user"><tr><td align="center">one <em>two</em></td></tr></table>
|
||||
|| one two ||
|
||||
<table class="user"><tr><td align="center">one two </td></tr></table>
|
||||
introduction\n\n||one||two||three||\n||||one two||three||
|
||||
introduction<table class="user"><tr><td>one</td><td>two</td><td>three</td></tr><tr><td colspan="2">one two</td><td>three</td></tr></table>
|
||||
||one||two||three||\n||||one two||three||\n\nfooter
|
||||
<table class="user"><tr><td>one</td><td>two</td><td>three</td></tr><tr><td colspan="2">one two</td><td>three</td></tr></table><p>footer</p>
|
||||
||one||two||three||\n||||one two||three||\n\nfooter
|
||||
<table class="user"><tr><td>one</td><td>two</td><td>three</td></tr><tr><td colspan="2">one two</td><td>three</td></tr></table><p>footer</p>
|
||||
|| one|| two|| three||\n|||| one two|| three||\n\nfooter
|
||||
<table class="user"><tr><td align="right">one</td><td align="right">two</td><td align="right">three</td></tr><tr><td colspan="2" align="right">one two</td><td align="right">three</td></tr></table><p>footer</p>
|
||||
||one ||two ||three ||\n||||one two ||three ||\n\nfooter
|
||||
<table class="user"><tr><td align="left">one </td><td align="left">two </td><td align="left">three </td></tr><tr><td colspan="2" align="left">one two </td><td align="left">three </td></tr></table><p>footer</p>
|
||||
|| one || two || three ||\n|||| one two || three ||\n\nfooter
|
||||
<table class="user"><tr><td align="center">one </td><td align="center">two </td><td align="center">three </td></tr><tr><td colspan="2" align="center">one two </td><td align="center">three </td></tr></table><p>footer</p>
|
||||
introduction\n\n||one||two||three||\n||||one two||three||\n\nfooter
|
||||
introduction<table class="user"><tr><td>one</td><td>two</td><td>three</td></tr><tr><td colspan="2">one two</td><td>three</td></tr></table><p>footer</p>
|
||||
source
|
||||
<pre> source</pre>
|
||||
source\n etc\n
|
||||
<pre> source\n etc</pre>
|
||||
source\n \n etc\n
|
||||
<pre> source\n \n etc</pre>
|
||||
source\n \n etc\n\nother
|
||||
<pre> source\n \n etc</pre><p>other</p>
|
||||
= title =
|
||||
<h2>title</h2>
|
||||
==title=
|
||||
<h2>title</h2>
|
||||
========fnord=
|
||||
<h6>fnord</h6>
|
||||
== nada\nnada ==
|
||||
== nada nada ==
|
||||
== nada ==
|
||||
<pre> == nada ==</pre>
|
||||
==[[Free Link]]==
|
||||
<h2>[[Free Link]]</h2>
|
||||
EOT
|
||||
Reference in New Issue
Block a user