forked from github/kensanata.oddmuse
Convert to Unix EOL.
Fix the reinitialization after the creation of InterMap pages.
This commit is contained in:
112
t/aggregate.t
112
t/aggregate.t
@@ -1,56 +1,56 @@
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 20;
|
||||
|
||||
clear_pages();
|
||||
add_module('aggregate.pl');
|
||||
|
||||
update_page('InnocentPage', 'We are innocent!');
|
||||
update_page('NicePage', 'You are nice.');
|
||||
update_page('OtherPage', 'This is off-topic.');
|
||||
update_page('Front_Page', q{Hello!
|
||||
<aggregate "NicePage" "OtherPage">
|
||||
The End.});
|
||||
|
||||
$page = get_page('Front_Page');
|
||||
xpath_test($page, '//div[@class="content browse"]/p[text()="Hello! "]',
|
||||
'//div[@class="aggregate journal"]/div[@class="page"]/h2/a[@class="local"][text()="NicePage"]',
|
||||
'//div[@class="aggregate journal"]/div[@class="page"]/h2/a[@class="local"][text()="OtherPage"]',
|
||||
'//div[@class="page"]/p[text()="You are nice."]',
|
||||
'//div[@class="page"]/p[text()="This is off-topic."]',
|
||||
'//div[@class="content browse"]/p[text()=" The End."]');
|
||||
|
||||
$page = get_page('action=aggregate id=Front_Page');
|
||||
test_page($page, '<title>NicePage</title>',
|
||||
'<title>OtherPage</title>',
|
||||
'<link>http://localhost/wiki.pl/NicePage</link>',
|
||||
'<link>http://localhost/wiki.pl/OtherPage</link>',
|
||||
'<description><p>You are nice.</p></description>',
|
||||
'<description><p>This is off-topic.</p></description>',
|
||||
'<wiki:status>new</wiki:status>',
|
||||
'<wiki:importance>major</wiki:importance>',
|
||||
quotemeta('<wiki:history>http://localhost/wiki.pl?action=history;id=NicePage</wiki:history>'),
|
||||
quotemeta('<wiki:diff>http://localhost/wiki.pl?action=browse;diff=1;id=NicePage</wiki:diff>'),
|
||||
quotemeta('<wiki:history>http://localhost/wiki.pl?action=history;id=OtherPage</wiki:history>'),
|
||||
quotemeta('<wiki:diff>http://localhost/wiki.pl?action=browse;diff=1;id=OtherPage</wiki:diff>'),
|
||||
'<title>Wiki: Front Page</title>',
|
||||
'<link>http://localhost/wiki.pl/Front_Page</link>',
|
||||
);
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 20;
|
||||
|
||||
clear_pages();
|
||||
add_module('aggregate.pl');
|
||||
|
||||
update_page('InnocentPage', 'We are innocent!');
|
||||
update_page('NicePage', 'You are nice.');
|
||||
update_page('OtherPage', 'This is off-topic.');
|
||||
update_page('Front_Page', q{Hello!
|
||||
<aggregate "NicePage" "OtherPage">
|
||||
The End.});
|
||||
|
||||
$page = get_page('Front_Page');
|
||||
xpath_test($page, '//div[@class="content browse"]/p[text()="Hello! "]',
|
||||
'//div[@class="aggregate journal"]/div[@class="page"]/h2/a[@class="local"][text()="NicePage"]',
|
||||
'//div[@class="aggregate journal"]/div[@class="page"]/h2/a[@class="local"][text()="OtherPage"]',
|
||||
'//div[@class="page"]/p[text()="You are nice."]',
|
||||
'//div[@class="page"]/p[text()="This is off-topic."]',
|
||||
'//div[@class="content browse"]/p[text()=" The End."]');
|
||||
|
||||
$page = get_page('action=aggregate id=Front_Page');
|
||||
test_page($page, '<title>NicePage</title>',
|
||||
'<title>OtherPage</title>',
|
||||
'<link>http://localhost/wiki.pl/NicePage</link>',
|
||||
'<link>http://localhost/wiki.pl/OtherPage</link>',
|
||||
'<description><p>You are nice.</p></description>',
|
||||
'<description><p>This is off-topic.</p></description>',
|
||||
'<wiki:status>new</wiki:status>',
|
||||
'<wiki:importance>major</wiki:importance>',
|
||||
quotemeta('<wiki:history>http://localhost/wiki.pl?action=history;id=NicePage</wiki:history>'),
|
||||
quotemeta('<wiki:diff>http://localhost/wiki.pl?action=browse;diff=1;id=NicePage</wiki:diff>'),
|
||||
quotemeta('<wiki:history>http://localhost/wiki.pl?action=history;id=OtherPage</wiki:history>'),
|
||||
quotemeta('<wiki:diff>http://localhost/wiki.pl?action=browse;diff=1;id=OtherPage</wiki:diff>'),
|
||||
'<title>Wiki: Front Page</title>',
|
||||
'<link>http://localhost/wiki.pl/Front_Page</link>',
|
||||
);
|
||||
|
||||
100
t/anchors.t
100
t/anchors.t
@@ -1,50 +1,50 @@
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 8;
|
||||
|
||||
clear_pages();
|
||||
|
||||
do 'modules/anchors.pl';
|
||||
do 'modules/link-all.pl'; # check compatibility
|
||||
|
||||
xpath_run_tests(split('\n',<<'EOT'));
|
||||
This is a [:day for fun and laughter].
|
||||
//a[@class="anchor"][@name="day_for_fun_and_laughter"]
|
||||
[[#day for fun and laughter]].
|
||||
//a[@class="local anchor"][@href="#day_for_fun_and_laughter"][text()="day for fun and laughter"]
|
||||
[[2004-08-17#day for fun and laughter]].
|
||||
//a[@class="local anchor"][@href="http://localhost/test.pl/2004-08-17#day_for_fun_and_laughter"][text()="2004-08-17#day for fun and laughter"]
|
||||
[[[#day for fun and laughter]]].
|
||||
//text()[string()="["]/following-sibling::a[@class="local anchor"][@href="#day_for_fun_and_laughter"][text()="day for fun and laughter"]/following-sibling::text()[string()="]."]
|
||||
[[[2004-08-17#day for fun and laughter]]].
|
||||
//a[@class="local anchor number"][@title="2004-08-17#day_for_fun_and_laughter"][@href="http://localhost/test.pl/2004-08-17#day_for_fun_and_laughter"]/span/span[@class="bracket"][text()="["]/following-sibling::text()[string()="1"]/following-sibling::span[@class="bracket"][text()="]"]
|
||||
[[2004-08-17#day for fun and laughter|boo]].
|
||||
//a[@class="local anchor"][@href="http://localhost/test.pl/2004-08-17#day_for_fun_and_laughter"][text()="boo"]
|
||||
EOT
|
||||
|
||||
$BracketWiki = 0;
|
||||
|
||||
run_tests(split('\n',<<'EOT'));
|
||||
[[#day for fun and laughter|boo]].
|
||||
[[#day for fun and laughter|boo]].
|
||||
[[2004-08-17#day for fun and laughter|boo]].
|
||||
[[2004-08-17#day for fun and laughter|boo]].
|
||||
EOT
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 8;
|
||||
|
||||
clear_pages();
|
||||
|
||||
do 'modules/anchors.pl';
|
||||
do 'modules/link-all.pl'; # check compatibility
|
||||
|
||||
xpath_run_tests(split('\n',<<'EOT'));
|
||||
This is a [:day for fun and laughter].
|
||||
//a[@class="anchor"][@name="day_for_fun_and_laughter"]
|
||||
[[#day for fun and laughter]].
|
||||
//a[@class="local anchor"][@href="#day_for_fun_and_laughter"][text()="day for fun and laughter"]
|
||||
[[2004-08-17#day for fun and laughter]].
|
||||
//a[@class="local anchor"][@href="http://localhost/test.pl/2004-08-17#day_for_fun_and_laughter"][text()="2004-08-17#day for fun and laughter"]
|
||||
[[[#day for fun and laughter]]].
|
||||
//text()[string()="["]/following-sibling::a[@class="local anchor"][@href="#day_for_fun_and_laughter"][text()="day for fun and laughter"]/following-sibling::text()[string()="]."]
|
||||
[[[2004-08-17#day for fun and laughter]]].
|
||||
//a[@class="local anchor number"][@title="2004-08-17#day_for_fun_and_laughter"][@href="http://localhost/test.pl/2004-08-17#day_for_fun_and_laughter"]/span/span[@class="bracket"][text()="["]/following-sibling::text()[string()="1"]/following-sibling::span[@class="bracket"][text()="]"]
|
||||
[[2004-08-17#day for fun and laughter|boo]].
|
||||
//a[@class="local anchor"][@href="http://localhost/test.pl/2004-08-17#day_for_fun_and_laughter"][text()="boo"]
|
||||
EOT
|
||||
|
||||
$BracketWiki = 0;
|
||||
|
||||
run_tests(split('\n',<<'EOT'));
|
||||
[[#day for fun and laughter|boo]].
|
||||
[[#day for fun and laughter|boo]].
|
||||
[[2004-08-17#day for fun and laughter|boo]].
|
||||
[[2004-08-17#day for fun and laughter|boo]].
|
||||
EOT
|
||||
|
||||
154
t/ban.t
154
t/ban.t
@@ -1,77 +1,77 @@
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 18;
|
||||
|
||||
clear_pages();
|
||||
|
||||
$localhost = 'confusibombus';
|
||||
$ENV{'REMOTE_ADDR'} = $localhost;
|
||||
|
||||
## Edit banned hosts as a normal user should fail
|
||||
|
||||
test_page(update_page('BannedHosts', "# Foo\n#Bar\n$localhost\n", 'banning me'),
|
||||
'Describe the new page here');
|
||||
|
||||
## Edit banned hosts as admin should succeed
|
||||
|
||||
test_page(update_page('BannedHosts', "#Foo\n#Bar\n$localhost\n", 'banning me', 0, 1),
|
||||
"Foo",
|
||||
$localhost);
|
||||
|
||||
## Edit banned hosts as a normal user should fail
|
||||
|
||||
test_page(update_page('BannedHosts', "Something else.", 'banning me'),
|
||||
"Foo",
|
||||
$localhost);
|
||||
|
||||
## Try to edit another page as a banned user
|
||||
|
||||
test_page(update_page('BannedUser', 'This is a test which should fail.', 'banning test'),
|
||||
'Describe the new page here');
|
||||
|
||||
## Try to edit the same page as a banned user with admin password
|
||||
|
||||
test_page(update_page('BannedUser', 'This is a test.', 'banning test', 0, 1),
|
||||
"This is a test");
|
||||
|
||||
## Unbann myself again, testing the regexp
|
||||
|
||||
test_page(update_page('BannedHosts', "#Foo\n#Bar\n", 'banning me', 0, 1), "Foo", "Bar");
|
||||
|
||||
## Banning content
|
||||
|
||||
update_page('BannedContent', "# cosa\nmafia\n#nostra\n", 'one banned word', 0, 1);
|
||||
test_page(update_page('CriminalPage', 'This is about http://mafia.example.com'),
|
||||
'Describe the new page here');
|
||||
|
||||
test_page($redirect, split('\n',<<'EOT'));
|
||||
banned text
|
||||
wiki administrator
|
||||
matched
|
||||
See .*BannedContent.* for more information
|
||||
EOT
|
||||
|
||||
test_page(update_page('CriminalPage', 'This is about http://nafia.example.com'),
|
||||
"This is about", "http://nafia.example.com");
|
||||
test_page(update_page('CriminalPage', 'This is about the cosa nostra'),
|
||||
'cosa nostra');
|
||||
test_page(update_page('CriminalPage', 'This is about the mafia'),
|
||||
'This is about the mafia'); # not in an url
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 18;
|
||||
|
||||
clear_pages();
|
||||
|
||||
$localhost = 'confusibombus';
|
||||
$ENV{'REMOTE_ADDR'} = $localhost;
|
||||
|
||||
## Edit banned hosts as a normal user should fail
|
||||
|
||||
test_page(update_page('BannedHosts', "# Foo\n#Bar\n$localhost\n", 'banning me'),
|
||||
'Describe the new page here');
|
||||
|
||||
## Edit banned hosts as admin should succeed
|
||||
|
||||
test_page(update_page('BannedHosts', "#Foo\n#Bar\n$localhost\n", 'banning me', 0, 1),
|
||||
"Foo",
|
||||
$localhost);
|
||||
|
||||
## Edit banned hosts as a normal user should fail
|
||||
|
||||
test_page(update_page('BannedHosts', "Something else.", 'banning me'),
|
||||
"Foo",
|
||||
$localhost);
|
||||
|
||||
## Try to edit another page as a banned user
|
||||
|
||||
test_page(update_page('BannedUser', 'This is a test which should fail.', 'banning test'),
|
||||
'Describe the new page here');
|
||||
|
||||
## Try to edit the same page as a banned user with admin password
|
||||
|
||||
test_page(update_page('BannedUser', 'This is a test.', 'banning test', 0, 1),
|
||||
"This is a test");
|
||||
|
||||
## Unbann myself again, testing the regexp
|
||||
|
||||
test_page(update_page('BannedHosts', "#Foo\n#Bar\n", 'banning me', 0, 1), "Foo", "Bar");
|
||||
|
||||
## Banning content
|
||||
|
||||
update_page('BannedContent', "# cosa\nmafia\n#nostra\n", 'one banned word', 0, 1);
|
||||
test_page(update_page('CriminalPage', 'This is about http://mafia.example.com'),
|
||||
'Describe the new page here');
|
||||
|
||||
test_page($redirect, split('\n',<<'EOT'));
|
||||
banned text
|
||||
wiki administrator
|
||||
matched
|
||||
See .*BannedContent.* for more information
|
||||
EOT
|
||||
|
||||
test_page(update_page('CriminalPage', 'This is about http://nafia.example.com'),
|
||||
"This is about", "http://nafia.example.com");
|
||||
test_page(update_page('CriminalPage', 'This is about the cosa nostra'),
|
||||
'cosa nostra');
|
||||
test_page(update_page('CriminalPage', 'This is about the mafia'),
|
||||
'This is about the mafia'); # not in an url
|
||||
|
||||
82
t/cache.t
82
t/cache.t
@@ -1,41 +1,41 @@
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 4;
|
||||
|
||||
clear_pages();
|
||||
|
||||
$str = 'This is a WikiLink.';
|
||||
|
||||
# this setting produces no link.
|
||||
AppendStringToFile($ConfigFile, "\$WikiLinks = 0;\n");
|
||||
test_page(update_page('CacheTest', $str, '', 1), $str);
|
||||
|
||||
# now change the setting, you still get no link because the cache has
|
||||
# not been updated.
|
||||
AppendStringToFile($ConfigFile, "\$WikiLinks = 1;\n");
|
||||
test_page(get_page('CacheTest'), $str);
|
||||
|
||||
# refresh the cache
|
||||
test_page(get_page('action=clear pwd=foo'), 'Clear Cache');
|
||||
|
||||
# now there is a link
|
||||
# This is a WikiLink<a class="edit" title="Click to edit this page" href="http://localhost/wiki.pl\?action=edit;id=WikiLink">\?</a>.
|
||||
xpath_test(get_page('CacheTest'), '//a[@class="edit"][@title="Click to edit this page"][@href="http://localhost/wiki.pl?action=edit;id=WikiLink"][text()="?"]');
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 4;
|
||||
|
||||
clear_pages();
|
||||
|
||||
$str = 'This is a WikiLink.';
|
||||
|
||||
# this setting produces no link.
|
||||
AppendStringToFile($ConfigFile, "\$WikiLinks = 0;\n");
|
||||
test_page(update_page('CacheTest', $str, '', 1), $str);
|
||||
|
||||
# now change the setting, you still get no link because the cache has
|
||||
# not been updated.
|
||||
AppendStringToFile($ConfigFile, "\$WikiLinks = 1;\n");
|
||||
test_page(get_page('CacheTest'), $str);
|
||||
|
||||
# refresh the cache
|
||||
test_page(get_page('action=clear pwd=foo'), 'Clear Cache');
|
||||
|
||||
# now there is a link
|
||||
# This is a WikiLink<a class="edit" title="Click to edit this page" href="http://localhost/wiki.pl\?action=edit;id=WikiLink">\?</a>.
|
||||
xpath_test(get_page('CacheTest'), '//a[@class="edit"][@title="Click to edit this page"][@href="http://localhost/wiki.pl?action=edit;id=WikiLink"][text()="?"]');
|
||||
|
||||
114
t/calendar.t
114
t/calendar.t
@@ -1,57 +1,57 @@
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 6;
|
||||
clear_pages();
|
||||
|
||||
my ($sec, $min, $hour, $mday, $mon, $year) = localtime($Now);
|
||||
$mon++;
|
||||
$year += 1900;
|
||||
my $year_next = $year +1;
|
||||
my $year_prev = $year -1;
|
||||
my $today = sprintf("%d-%02d-%02d", $year, $mon, $mday);
|
||||
$oday = $mday -1;
|
||||
$oday += 2 if $oday < 1;
|
||||
my $otherday = sprintf("%d-%02d-%02d", $year, $mon, $oday);
|
||||
|
||||
add_module('calendar.pl');
|
||||
|
||||
xpath_test(get_page('action=calendar'),
|
||||
# yearly navigation
|
||||
'//div[@class="content cal year"]/p[@class="nav"]/a[@href="http://localhost/wiki.pl?action=calendar;year=' . $year_prev . '"][text()="Previous"]/following-sibling::text()[string()=" | "]/following-sibling::a[@href="http://localhost/wiki.pl?action=calendar;year=' . $year_next . '"][text()="Next"]',
|
||||
# monthly collection
|
||||
'//div[@class="cal month"]/pre/span[@class="title"]/a[@class="local collection month"][@href="http://localhost/wiki.pl?action=collect;match=%5e' . sprintf("%d-%02d", $year, $mon) . '"]',
|
||||
# today day edit
|
||||
'//a[@class="edit today"][@href="http://localhost/wiki.pl?action=edit;id=' . $today . '"][normalize-space(text())="' . $mday . '"]',
|
||||
# other day edit
|
||||
'//a[@class="edit"][@href="http://localhost/wiki.pl?action=edit;id=' . $otherday . '"][normalize-space(text())="' . $oday . '"]',
|
||||
);
|
||||
|
||||
update_page($today, "yadda");
|
||||
|
||||
xpath_test(get_page('action=calendar'),
|
||||
# day exact match
|
||||
'//a[@class="local exact today"][@href="http://localhost/wiki.pl/' . $today . '"][normalize-space(text())="' . $mday . '"]');
|
||||
|
||||
update_page("${today}_more", "more yadda");
|
||||
|
||||
xpath_test(get_page('action=calendar'),
|
||||
# today exact match
|
||||
'//a[@class="local collection today"][@href="http://localhost/wiki.pl?action=collect;match=%5e' . $today . '"][normalize-space(text())="' . $mday . '"]');
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 6;
|
||||
clear_pages();
|
||||
|
||||
my ($sec, $min, $hour, $mday, $mon, $year) = localtime($Now);
|
||||
$mon++;
|
||||
$year += 1900;
|
||||
my $year_next = $year +1;
|
||||
my $year_prev = $year -1;
|
||||
my $today = sprintf("%d-%02d-%02d", $year, $mon, $mday);
|
||||
$oday = $mday -1;
|
||||
$oday += 2 if $oday < 1;
|
||||
my $otherday = sprintf("%d-%02d-%02d", $year, $mon, $oday);
|
||||
|
||||
add_module('calendar.pl');
|
||||
|
||||
xpath_test(get_page('action=calendar'),
|
||||
# yearly navigation
|
||||
'//div[@class="content cal year"]/p[@class="nav"]/a[@href="http://localhost/wiki.pl?action=calendar;year=' . $year_prev . '"][text()="Previous"]/following-sibling::text()[string()=" | "]/following-sibling::a[@href="http://localhost/wiki.pl?action=calendar;year=' . $year_next . '"][text()="Next"]',
|
||||
# monthly collection
|
||||
'//div[@class="cal month"]/pre/span[@class="title"]/a[@class="local collection month"][@href="http://localhost/wiki.pl?action=collect;match=%5e' . sprintf("%d-%02d", $year, $mon) . '"]',
|
||||
# today day edit
|
||||
'//a[@class="edit today"][@href="http://localhost/wiki.pl?action=edit;id=' . $today . '"][normalize-space(text())="' . $mday . '"]',
|
||||
# other day edit
|
||||
'//a[@class="edit"][@href="http://localhost/wiki.pl?action=edit;id=' . $otherday . '"][normalize-space(text())="' . $oday . '"]',
|
||||
);
|
||||
|
||||
update_page($today, "yadda");
|
||||
|
||||
xpath_test(get_page('action=calendar'),
|
||||
# day exact match
|
||||
'//a[@class="local exact today"][@href="http://localhost/wiki.pl/' . $today . '"][normalize-space(text())="' . $mday . '"]');
|
||||
|
||||
update_page("${today}_more", "more yadda");
|
||||
|
||||
xpath_test(get_page('action=calendar'),
|
||||
# today exact match
|
||||
'//a[@class="local collection today"][@href="http://localhost/wiki.pl?action=collect;match=%5e' . $today . '"][normalize-space(text())="' . $mday . '"]');
|
||||
|
||||
158
t/clusters.t
158
t/clusters.t
@@ -1,79 +1,79 @@
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 38;
|
||||
|
||||
clear_pages();
|
||||
|
||||
AppendStringToFile($ConfigFile, "\$PageCluster = 'Cluster';\n");
|
||||
|
||||
update_page('ClusterIdea', 'This is just a page.', 'one');
|
||||
update_page('ClusterIdea', "This is just a page.\nBut somebody has to do it.", 'two');
|
||||
update_page('ClusterIdea', "This is just a page.\nNobody wants it.", 'three', 1);
|
||||
update_page('ClusterIdea', "MainPage\nThis is just a page.\nBut somebody has to do it.", 'four');
|
||||
|
||||
test_page(get_page('action=rc'), 'Cluster.*MainPage');
|
||||
|
||||
test_page(get_page('action=rc all=1'), qw(Cluster.*MainPage ClusterIdea.*two ClusterIdea.*one));
|
||||
|
||||
test_page(get_page('action=rc all=1 showedit=1'), qw(Cluster.*MainPage ClusterIdea.*three
|
||||
ClusterIdea.*two ClusterIdea.*one));
|
||||
|
||||
update_page('MainPage', 'Finally the main page.', 'main summary');
|
||||
test_page(get_page('action=browse id=MainPage rcclusteronly=MainPage'), split('\n',<<'EOT'));
|
||||
Finally the main page
|
||||
Updates in the last [0-9]+ days
|
||||
diff.*ClusterIdea.*history.*four
|
||||
for.*MainPage.*only
|
||||
1 day
|
||||
action=browse;id=MainPage;rcclusteronly=MainPage;days=1;all=0;showedit=0
|
||||
EOT
|
||||
|
||||
@Test = split('\n',<<'EOT');
|
||||
Finally the main page
|
||||
Updates in the last [0-9]+ days
|
||||
diff.*ClusterIdea.*four
|
||||
for.*MainPage.*only
|
||||
1 day
|
||||
EOT
|
||||
|
||||
test_page(get_page('action=browse id=MainPage rcclusteronly=MainPage showedit=1'),
|
||||
(@Test, 'action=browse;id=MainPage;rcclusteronly=MainPage;days=1;all=0;showedit=1'));
|
||||
test_page(get_page('action=browse id=MainPage rcclusteronly=MainPage all=1'),
|
||||
(@Test, 'action=browse;id=MainPage;rcclusteronly=MainPage;days=1;all=1;showedit=0'));
|
||||
|
||||
update_page('ClusterIdea', "MainPage\nSomebody has to do it.", 'five', 1);
|
||||
test_page(get_page('action=browse id=MainPage rcclusteronly=MainPage all=1 showedit=1'), split('\n',<<'EOT'));
|
||||
Finally the main page
|
||||
Updates in the last [0-9]+ days
|
||||
diff.*ClusterIdea.*five
|
||||
diff.*ClusterIdea.*four
|
||||
for.*MainPage.*only
|
||||
1 day
|
||||
action=browse;id=MainPage;rcclusteronly=MainPage;days=1;all=1;showedit=1
|
||||
EOT
|
||||
|
||||
test_page(get_page('action=rss'), 'action=browse;id=MainPage;rcclusteronly=MainPage');
|
||||
|
||||
update_page('OtherIdea', "MainPage\nThis is another page.\n", 'new page in cluster');
|
||||
$page = get_page('action=rc raw=1');
|
||||
test_page($page, 'title: MainPage', 'description: OtherIdea: new page in cluster',
|
||||
'description: main summary');
|
||||
test_page_negative($page, 'ClusterIdea');
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 38;
|
||||
|
||||
clear_pages();
|
||||
|
||||
AppendStringToFile($ConfigFile, "\$PageCluster = 'Cluster';\n");
|
||||
|
||||
update_page('ClusterIdea', 'This is just a page.', 'one');
|
||||
update_page('ClusterIdea', "This is just a page.\nBut somebody has to do it.", 'two');
|
||||
update_page('ClusterIdea', "This is just a page.\nNobody wants it.", 'three', 1);
|
||||
update_page('ClusterIdea', "MainPage\nThis is just a page.\nBut somebody has to do it.", 'four');
|
||||
|
||||
test_page(get_page('action=rc'), 'Cluster.*MainPage');
|
||||
|
||||
test_page(get_page('action=rc all=1'), qw(Cluster.*MainPage ClusterIdea.*two ClusterIdea.*one));
|
||||
|
||||
test_page(get_page('action=rc all=1 showedit=1'), qw(Cluster.*MainPage ClusterIdea.*three
|
||||
ClusterIdea.*two ClusterIdea.*one));
|
||||
|
||||
update_page('MainPage', 'Finally the main page.', 'main summary');
|
||||
test_page(get_page('action=browse id=MainPage rcclusteronly=MainPage'), split('\n',<<'EOT'));
|
||||
Finally the main page
|
||||
Updates in the last [0-9]+ days
|
||||
diff.*ClusterIdea.*history.*four
|
||||
for.*MainPage.*only
|
||||
1 day
|
||||
action=browse;id=MainPage;rcclusteronly=MainPage;days=1;all=0;showedit=0
|
||||
EOT
|
||||
|
||||
@Test = split('\n',<<'EOT');
|
||||
Finally the main page
|
||||
Updates in the last [0-9]+ days
|
||||
diff.*ClusterIdea.*four
|
||||
for.*MainPage.*only
|
||||
1 day
|
||||
EOT
|
||||
|
||||
test_page(get_page('action=browse id=MainPage rcclusteronly=MainPage showedit=1'),
|
||||
(@Test, 'action=browse;id=MainPage;rcclusteronly=MainPage;days=1;all=0;showedit=1'));
|
||||
test_page(get_page('action=browse id=MainPage rcclusteronly=MainPage all=1'),
|
||||
(@Test, 'action=browse;id=MainPage;rcclusteronly=MainPage;days=1;all=1;showedit=0'));
|
||||
|
||||
update_page('ClusterIdea', "MainPage\nSomebody has to do it.", 'five', 1);
|
||||
test_page(get_page('action=browse id=MainPage rcclusteronly=MainPage all=1 showedit=1'), split('\n',<<'EOT'));
|
||||
Finally the main page
|
||||
Updates in the last [0-9]+ days
|
||||
diff.*ClusterIdea.*five
|
||||
diff.*ClusterIdea.*four
|
||||
for.*MainPage.*only
|
||||
1 day
|
||||
action=browse;id=MainPage;rcclusteronly=MainPage;days=1;all=1;showedit=1
|
||||
EOT
|
||||
|
||||
test_page(get_page('action=rss'), 'action=browse;id=MainPage;rcclusteronly=MainPage');
|
||||
|
||||
update_page('OtherIdea', "MainPage\nThis is another page.\n", 'new page in cluster');
|
||||
$page = get_page('action=rc raw=1');
|
||||
test_page($page, 'title: MainPage', 'description: OtherIdea: new page in cluster',
|
||||
'description: main summary');
|
||||
test_page_negative($page, 'ClusterIdea');
|
||||
|
||||
202
t/comments.t
202
t/comments.t
@@ -1,101 +1,101 @@
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 35;
|
||||
clear_pages();
|
||||
|
||||
AppendStringToFile($ConfigFile, "\$CommentsPrefix = 'Comments on ';\n");
|
||||
|
||||
# $EditAllowed
|
||||
|
||||
$page = update_page('Test', 'Can edit page by default');
|
||||
test_page($page, 'Can edit page by default');
|
||||
xpath_test($page,
|
||||
'//a[@class="comment local"][@href="http://localhost/wiki.pl/Comments_on_Test"][text()="Comments on Test"]',
|
||||
'//a[@class="edit"][@href="http://localhost/wiki.pl?action=edit;id=Test"][text()="Edit this page"]');
|
||||
$page = update_page('Comments_on_Test', 'Can edit comment by default');
|
||||
test_page($page, 'Can edit comment by default');
|
||||
xpath_test($page,
|
||||
'//a[@class="original local"][@href="http://localhost/wiki.pl/Test"][text()="Test"]',
|
||||
'//a[@class="edit"][@href="http://localhost/wiki.pl?action=edit;id=Comments_on_Test"][text()="Edit this page"]',
|
||||
'//textarea[@name="aftertext"]');
|
||||
|
||||
AppendStringToFile($ConfigFile, "\$EditAllowed = 0;\n");
|
||||
|
||||
$page = update_page('Test', 'Cannot edit page with edit allowed eq 0');
|
||||
test_page($page, 'Can edit page by default');
|
||||
xpath_test($page,
|
||||
'//a[@class="password"][@href="http://localhost/wiki.pl?action=password"][text()="This page is read-only"]');
|
||||
$page = update_page('Comments_on_Test', 'Cannot edit comments with edit allowed eq 0');
|
||||
test_page($page, 'Can edit comment by default');
|
||||
xpath_test($page,
|
||||
'//a[@class="password"][@href="http://localhost/wiki.pl?action=password"][text()="This page is read-only"]');
|
||||
negative_xpath_test($page, '//textarea[@name="aftertext"]');
|
||||
|
||||
AppendStringToFile($ConfigFile, "\$EditAllowed = 2;\n");
|
||||
|
||||
$page = update_page('Test', 'Cannot edit page with edit allowed eq 2');
|
||||
test_page($page, 'Can edit page by default');
|
||||
xpath_test($page,
|
||||
'//a[@class="password"][@href="http://localhost/wiki.pl?action=password"][text()="This page is read-only"]');
|
||||
$page = update_page('Comments_on_Test', 'Can edit comments with edit allowed eq 2');
|
||||
test_page($page, 'Can edit comments with edit allowed eq 2');
|
||||
xpath_test($page,
|
||||
'//a[@class="original local"][@href="http://localhost/wiki.pl/Test"][text()="Test"]',
|
||||
'//a[@class="edit"][@href="http://localhost/wiki.pl?action=edit;id=Comments_on_Test"][text()="Edit this page"]',
|
||||
'//textarea[@name="aftertext"]');
|
||||
|
||||
AppendStringToFile($ConfigFile, "\$EditAllowed = 3;\n");
|
||||
|
||||
$page = update_page('Test', 'Cannot edit page with edit allowed = 3');
|
||||
test_page($page, 'Can edit page by default');
|
||||
xpath_test($page,
|
||||
'//a[@class="password"][@href="http://localhost/wiki.pl?action=password"][text()="This page is read-only"]');
|
||||
$page = update_page('Comments_on_Test', 'Can edit comments with edit allowed eq 3');
|
||||
test_page($page, 'Can edit comments with edit allowed eq 2');
|
||||
xpath_test($page,
|
||||
'//a[@class="original local"][@href="http://localhost/wiki.pl/Test"][text()="Test"]',
|
||||
'//a[@class="password"][@href="http://localhost/wiki.pl?action=password"][text()="This page is read-only"]',
|
||||
'//textarea[@name="aftertext"]');
|
||||
$page = update_page('Comments_on_Test', '', '', '', '', 'aftertext=Can%20add%20comments%20with%20edit%20allowed%20eq%203');
|
||||
test_page($page, 'Can add comments with edit allowed eq 3');
|
||||
|
||||
# Other tests
|
||||
|
||||
AppendStringToFile($ConfigFile, "\$EditAllowed = 1;\n");
|
||||
|
||||
get_page('title=Yadda', 'aftertext=This%20is%20my%20comment.', 'username=Alex');
|
||||
test_page(get_page('Yadda'), 'Describe the new page');
|
||||
|
||||
get_page('title=Comments_on_Yadda', 'aftertext=This%20is%20my%20comment.', 'username=Alex');
|
||||
test_page(get_page('Comments_on_Yadda'), 'This is my comment\.', '-- Alex');
|
||||
test_page(get_page('action=rc raw=1'), 'title: Comments on Yadda',
|
||||
'description: This is my comment.', 'generator: Alex');
|
||||
|
||||
get_page('title=Comments_on_Yadda', 'aftertext=This%20is%20another%20comment.',
|
||||
'username=Alex', 'homepage=http%3a%2f%2fwww%2eoddmuse%2eorg%2f');
|
||||
xpath_test(get_page('Comments_on_Yadda'),
|
||||
'//p[contains(text(),"This is my comment.")]',
|
||||
'//a[@class="url http outside"][@href="http://www.oddmuse.org/"][text()="Alex"]');
|
||||
|
||||
my $textarea = '//textarea[@name="aftertext"][@id="aftertext"]';
|
||||
xpath_test(get_page('Comments_on_Yadda'), $textarea);
|
||||
get_page('action=pagelock set=1 id=Comments_on_Yadda pwd=foo');
|
||||
negative_xpath_test(get_page('Comments_on_Yadda'), $textarea);
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 35;
|
||||
clear_pages();
|
||||
|
||||
AppendStringToFile($ConfigFile, "\$CommentsPrefix = 'Comments on ';\n");
|
||||
|
||||
# $EditAllowed
|
||||
|
||||
$page = update_page('Test', 'Can edit page by default');
|
||||
test_page($page, 'Can edit page by default');
|
||||
xpath_test($page,
|
||||
'//a[@class="comment local"][@href="http://localhost/wiki.pl/Comments_on_Test"][text()="Comments on Test"]',
|
||||
'//a[@class="edit"][@href="http://localhost/wiki.pl?action=edit;id=Test"][text()="Edit this page"]');
|
||||
$page = update_page('Comments_on_Test', 'Can edit comment by default');
|
||||
test_page($page, 'Can edit comment by default');
|
||||
xpath_test($page,
|
||||
'//a[@class="original local"][@href="http://localhost/wiki.pl/Test"][text()="Test"]',
|
||||
'//a[@class="edit"][@href="http://localhost/wiki.pl?action=edit;id=Comments_on_Test"][text()="Edit this page"]',
|
||||
'//textarea[@name="aftertext"]');
|
||||
|
||||
AppendStringToFile($ConfigFile, "\$EditAllowed = 0;\n");
|
||||
|
||||
$page = update_page('Test', 'Cannot edit page with edit allowed eq 0');
|
||||
test_page($page, 'Can edit page by default');
|
||||
xpath_test($page,
|
||||
'//a[@class="password"][@href="http://localhost/wiki.pl?action=password"][text()="This page is read-only"]');
|
||||
$page = update_page('Comments_on_Test', 'Cannot edit comments with edit allowed eq 0');
|
||||
test_page($page, 'Can edit comment by default');
|
||||
xpath_test($page,
|
||||
'//a[@class="password"][@href="http://localhost/wiki.pl?action=password"][text()="This page is read-only"]');
|
||||
negative_xpath_test($page, '//textarea[@name="aftertext"]');
|
||||
|
||||
AppendStringToFile($ConfigFile, "\$EditAllowed = 2;\n");
|
||||
|
||||
$page = update_page('Test', 'Cannot edit page with edit allowed eq 2');
|
||||
test_page($page, 'Can edit page by default');
|
||||
xpath_test($page,
|
||||
'//a[@class="password"][@href="http://localhost/wiki.pl?action=password"][text()="This page is read-only"]');
|
||||
$page = update_page('Comments_on_Test', 'Can edit comments with edit allowed eq 2');
|
||||
test_page($page, 'Can edit comments with edit allowed eq 2');
|
||||
xpath_test($page,
|
||||
'//a[@class="original local"][@href="http://localhost/wiki.pl/Test"][text()="Test"]',
|
||||
'//a[@class="edit"][@href="http://localhost/wiki.pl?action=edit;id=Comments_on_Test"][text()="Edit this page"]',
|
||||
'//textarea[@name="aftertext"]');
|
||||
|
||||
AppendStringToFile($ConfigFile, "\$EditAllowed = 3;\n");
|
||||
|
||||
$page = update_page('Test', 'Cannot edit page with edit allowed = 3');
|
||||
test_page($page, 'Can edit page by default');
|
||||
xpath_test($page,
|
||||
'//a[@class="password"][@href="http://localhost/wiki.pl?action=password"][text()="This page is read-only"]');
|
||||
$page = update_page('Comments_on_Test', 'Can edit comments with edit allowed eq 3');
|
||||
test_page($page, 'Can edit comments with edit allowed eq 2');
|
||||
xpath_test($page,
|
||||
'//a[@class="original local"][@href="http://localhost/wiki.pl/Test"][text()="Test"]',
|
||||
'//a[@class="password"][@href="http://localhost/wiki.pl?action=password"][text()="This page is read-only"]',
|
||||
'//textarea[@name="aftertext"]');
|
||||
$page = update_page('Comments_on_Test', '', '', '', '', 'aftertext=Can%20add%20comments%20with%20edit%20allowed%20eq%203');
|
||||
test_page($page, 'Can add comments with edit allowed eq 3');
|
||||
|
||||
# Other tests
|
||||
|
||||
AppendStringToFile($ConfigFile, "\$EditAllowed = 1;\n");
|
||||
|
||||
get_page('title=Yadda', 'aftertext=This%20is%20my%20comment.', 'username=Alex');
|
||||
test_page(get_page('Yadda'), 'Describe the new page');
|
||||
|
||||
get_page('title=Comments_on_Yadda', 'aftertext=This%20is%20my%20comment.', 'username=Alex');
|
||||
test_page(get_page('Comments_on_Yadda'), 'This is my comment\.', '-- Alex');
|
||||
test_page(get_page('action=rc raw=1'), 'title: Comments on Yadda',
|
||||
'description: This is my comment.', 'generator: Alex');
|
||||
|
||||
get_page('title=Comments_on_Yadda', 'aftertext=This%20is%20another%20comment.',
|
||||
'username=Alex', 'homepage=http%3a%2f%2fwww%2eoddmuse%2eorg%2f');
|
||||
xpath_test(get_page('Comments_on_Yadda'),
|
||||
'//p[contains(text(),"This is my comment.")]',
|
||||
'//a[@class="url http outside"][@href="http://www.oddmuse.org/"][text()="Alex"]');
|
||||
|
||||
my $textarea = '//textarea[@name="aftertext"][@id="aftertext"]';
|
||||
xpath_test(get_page('Comments_on_Yadda'), $textarea);
|
||||
get_page('action=pagelock set=1 id=Comments_on_Yadda pwd=foo');
|
||||
negative_xpath_test(get_page('Comments_on_Yadda'), $textarea);
|
||||
|
||||
426
t/conflict.t
426
t/conflict.t
@@ -1,213 +1,213 @@
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 16;
|
||||
|
||||
clear_pages();
|
||||
|
||||
# Using the example files from the diff3 manual
|
||||
|
||||
my $lao_file = q{The Way that can be told of is not the eternal Way;
|
||||
The name that can be named is not the eternal name.
|
||||
The Nameless is the origin of Heaven and Earth;
|
||||
The Named is the mother of all things.
|
||||
Therefore let there always be non-being,
|
||||
so we may see their subtlety,
|
||||
And let there always be being,
|
||||
so we may see their outcome.
|
||||
The two are the same,
|
||||
But after they are produced,
|
||||
they have different names.
|
||||
};
|
||||
|
||||
my $lao_file_1 = q{The Tao that can be told of is not the eternal Tao;
|
||||
The name that can be named is not the eternal name.
|
||||
The Nameless is the origin of Heaven and Earth;
|
||||
The Named is the mother of all things.
|
||||
Therefore let there always be non-being,
|
||||
so we may see their subtlety,
|
||||
And let there always be being,
|
||||
so we may see their outcome.
|
||||
The two are the same,
|
||||
But after they are produced,
|
||||
they have different names.
|
||||
};
|
||||
my $lao_file_2 = q{The Way that can be told of is not the eternal Way;
|
||||
The name that can be named is not the eternal name.
|
||||
The Nameless is the origin of Heaven and Earth;
|
||||
The Named is the mother of all things.
|
||||
Therefore let there always be non-being,
|
||||
so we may see their simplicity,
|
||||
And let there always be being,
|
||||
so we may see the result.
|
||||
The two are the same,
|
||||
But after they are produced,
|
||||
they have different names.
|
||||
};
|
||||
|
||||
my $tzu_file = q{The Nameless is the origin of Heaven and Earth;
|
||||
The named is the mother of all things.
|
||||
|
||||
Therefore let there always be non-being,
|
||||
so we may see their subtlety,
|
||||
And let there always be being,
|
||||
so we may see their outcome.
|
||||
The two are the same,
|
||||
But after they are produced,
|
||||
they have different names.
|
||||
They both may be called deep and profound.
|
||||
Deeper and more profound,
|
||||
The door of all subtleties!
|
||||
};
|
||||
|
||||
my $tao_file = q{The Way that can be told of is not the eternal Way;
|
||||
The name that can be named is not the eternal name.
|
||||
The Nameless is the origin of Heaven and Earth;
|
||||
The named is the mother of all things.
|
||||
|
||||
Therefore let there always be non-being,
|
||||
so we may see their subtlety,
|
||||
And let there always be being,
|
||||
so we may see their result.
|
||||
The two are the same,
|
||||
But after they are produced,
|
||||
they have different names.
|
||||
|
||||
-- The Way of Lao-Tzu, tr. Wing-tsit Chan
|
||||
};
|
||||
|
||||
# simple edit
|
||||
|
||||
$ENV{'REMOTE_ADDR'} = 'confusibombus';
|
||||
test_page(update_page('ConflictTest', $lao_file),
|
||||
'The Way that can be told of is not the eternal Way');
|
||||
|
||||
# edit from another address should result in conflict warning
|
||||
|
||||
$ENV{'REMOTE_ADDR'} = 'megabombus';
|
||||
test_page(update_page('ConflictTest', $tzu_file),
|
||||
'The Nameless is the origin of Heaven and Earth');
|
||||
|
||||
# test cookie!
|
||||
test_page($redirect, map { UrlEncode($_); }
|
||||
('This page was changed by somebody else',
|
||||
'Please check whether you overwrote those changes'));
|
||||
|
||||
# test normal merging -- first get oldtime, then do two conflicting edits
|
||||
# we need to wait at least a second after the last test in order to not
|
||||
# confuse oddmuse.
|
||||
|
||||
sleep(2);
|
||||
|
||||
update_page('ConflictTest', $lao_file);
|
||||
|
||||
$_ = `perl wiki.pl action=edit id=ConflictTest`;
|
||||
/name="oldtime" value="([0-9]+)"/;
|
||||
my $oldtime = $1;
|
||||
|
||||
sleep(2);
|
||||
|
||||
$ENV{'REMOTE_ADDR'} = 'confusibombus';
|
||||
update_page('ConflictTest', $lao_file_1);
|
||||
|
||||
sleep(2);
|
||||
|
||||
# merge success has lines from both lao_file_1 and lao_file_2
|
||||
$ENV{'REMOTE_ADDR'} = 'megabombus';
|
||||
test_page(update_page('ConflictTest', $lao_file_2,
|
||||
'', '', '', "oldtime=$oldtime"),
|
||||
'The Tao that can be told of', # file 1
|
||||
'The name that can be named', # both
|
||||
'so we may see their simplicity'); # file 2
|
||||
|
||||
# test conflict during merging -- first get oldtime, then do two conflicting edits
|
||||
|
||||
sleep(2);
|
||||
|
||||
update_page('ConflictTest', $tzu_file);
|
||||
|
||||
$_ = `perl wiki.pl action=edit id=ConflictTest`;
|
||||
/name="oldtime" value="([0-9]+)"/;
|
||||
$oldtime = $1;
|
||||
|
||||
sleep(2);
|
||||
|
||||
$ENV{'REMOTE_ADDR'} = 'confusibombus';
|
||||
update_page('ConflictTest', $tao_file);
|
||||
|
||||
sleep(2);
|
||||
|
||||
$ENV{'REMOTE_ADDR'} = 'megabombus';
|
||||
test_page(update_page('ConflictTest', $lao_file,
|
||||
'', '', '', "oldtime=$oldtime"),
|
||||
q{<pre class="conflict"><<<<<<< ancestor
|
||||
=======
|
||||
The Way that can be told of is not the eternal Way;
|
||||
The name that can be named is not the eternal name.
|
||||
>>>>>>> other
|
||||
</pre>},
|
||||
q{<pre class="conflict"><<<<<<< you
|
||||
||||||| ancestor
|
||||
They both may be called deep and profound.
|
||||
Deeper and more profound,
|
||||
The door of all subtleties!
|
||||
=======
|
||||
|
||||
-- The Way of Lao-Tzu, tr. Wing-tsit Chan
|
||||
>>>>>>> other
|
||||
</pre>});
|
||||
|
||||
@Test = split('\n',<<'EOT');
|
||||
This page was changed by somebody else
|
||||
The changes conflict
|
||||
EOT
|
||||
|
||||
test_page($redirect, map { UrlEncode($_); } @Test); # test cookie!
|
||||
|
||||
# test conflict during merging without merge! -- first get oldtime, then do two conflicting edits
|
||||
|
||||
AppendStringToFile($ConfigFile, "\$ENV{'PATH'} = '';\n");
|
||||
|
||||
sleep(2);
|
||||
|
||||
update_page('ConflictTest', $lao_file);
|
||||
|
||||
$_ = `perl wiki.pl action=edit id=ConflictTest`;
|
||||
/name="oldtime" value="([0-9]+)"/;
|
||||
$oldtime = $1;
|
||||
|
||||
sleep(2);
|
||||
|
||||
$ENV{'REMOTE_ADDR'} = 'confusibombus';
|
||||
update_page('ConflictTest', $lao_file_1);
|
||||
|
||||
sleep(2);
|
||||
|
||||
# merge not available -- must look for message
|
||||
$ENV{'REMOTE_ADDR'} = 'megabombus';
|
||||
test_page(update_page('ConflictTest', $lao_file_2,
|
||||
'', '', '', "oldtime=$oldtime"),
|
||||
'The Way that can be told of is not the eternal Way', # file 2
|
||||
'so we may see their simplicity', # file 2
|
||||
'so we may see the result'); # file 2
|
||||
|
||||
test_page($redirect, map { UrlEncode($_) }
|
||||
('This page was changed by somebody else',
|
||||
'Please check whether you overwrote those changes')); # test cookie!
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 16;
|
||||
|
||||
clear_pages();
|
||||
|
||||
# Using the example files from the diff3 manual
|
||||
|
||||
my $lao_file = q{The Way that can be told of is not the eternal Way;
|
||||
The name that can be named is not the eternal name.
|
||||
The Nameless is the origin of Heaven and Earth;
|
||||
The Named is the mother of all things.
|
||||
Therefore let there always be non-being,
|
||||
so we may see their subtlety,
|
||||
And let there always be being,
|
||||
so we may see their outcome.
|
||||
The two are the same,
|
||||
But after they are produced,
|
||||
they have different names.
|
||||
};
|
||||
|
||||
my $lao_file_1 = q{The Tao that can be told of is not the eternal Tao;
|
||||
The name that can be named is not the eternal name.
|
||||
The Nameless is the origin of Heaven and Earth;
|
||||
The Named is the mother of all things.
|
||||
Therefore let there always be non-being,
|
||||
so we may see their subtlety,
|
||||
And let there always be being,
|
||||
so we may see their outcome.
|
||||
The two are the same,
|
||||
But after they are produced,
|
||||
they have different names.
|
||||
};
|
||||
my $lao_file_2 = q{The Way that can be told of is not the eternal Way;
|
||||
The name that can be named is not the eternal name.
|
||||
The Nameless is the origin of Heaven and Earth;
|
||||
The Named is the mother of all things.
|
||||
Therefore let there always be non-being,
|
||||
so we may see their simplicity,
|
||||
And let there always be being,
|
||||
so we may see the result.
|
||||
The two are the same,
|
||||
But after they are produced,
|
||||
they have different names.
|
||||
};
|
||||
|
||||
my $tzu_file = q{The Nameless is the origin of Heaven and Earth;
|
||||
The named is the mother of all things.
|
||||
|
||||
Therefore let there always be non-being,
|
||||
so we may see their subtlety,
|
||||
And let there always be being,
|
||||
so we may see their outcome.
|
||||
The two are the same,
|
||||
But after they are produced,
|
||||
they have different names.
|
||||
They both may be called deep and profound.
|
||||
Deeper and more profound,
|
||||
The door of all subtleties!
|
||||
};
|
||||
|
||||
my $tao_file = q{The Way that can be told of is not the eternal Way;
|
||||
The name that can be named is not the eternal name.
|
||||
The Nameless is the origin of Heaven and Earth;
|
||||
The named is the mother of all things.
|
||||
|
||||
Therefore let there always be non-being,
|
||||
so we may see their subtlety,
|
||||
And let there always be being,
|
||||
so we may see their result.
|
||||
The two are the same,
|
||||
But after they are produced,
|
||||
they have different names.
|
||||
|
||||
-- The Way of Lao-Tzu, tr. Wing-tsit Chan
|
||||
};
|
||||
|
||||
# simple edit
|
||||
|
||||
$ENV{'REMOTE_ADDR'} = 'confusibombus';
|
||||
test_page(update_page('ConflictTest', $lao_file),
|
||||
'The Way that can be told of is not the eternal Way');
|
||||
|
||||
# edit from another address should result in conflict warning
|
||||
|
||||
$ENV{'REMOTE_ADDR'} = 'megabombus';
|
||||
test_page(update_page('ConflictTest', $tzu_file),
|
||||
'The Nameless is the origin of Heaven and Earth');
|
||||
|
||||
# test cookie!
|
||||
test_page($redirect, map { UrlEncode($_); }
|
||||
('This page was changed by somebody else',
|
||||
'Please check whether you overwrote those changes'));
|
||||
|
||||
# test normal merging -- first get oldtime, then do two conflicting edits
|
||||
# we need to wait at least a second after the last test in order to not
|
||||
# confuse oddmuse.
|
||||
|
||||
sleep(2);
|
||||
|
||||
update_page('ConflictTest', $lao_file);
|
||||
|
||||
$_ = `perl wiki.pl action=edit id=ConflictTest`;
|
||||
/name="oldtime" value="([0-9]+)"/;
|
||||
my $oldtime = $1;
|
||||
|
||||
sleep(2);
|
||||
|
||||
$ENV{'REMOTE_ADDR'} = 'confusibombus';
|
||||
update_page('ConflictTest', $lao_file_1);
|
||||
|
||||
sleep(2);
|
||||
|
||||
# merge success has lines from both lao_file_1 and lao_file_2
|
||||
$ENV{'REMOTE_ADDR'} = 'megabombus';
|
||||
test_page(update_page('ConflictTest', $lao_file_2,
|
||||
'', '', '', "oldtime=$oldtime"),
|
||||
'The Tao that can be told of', # file 1
|
||||
'The name that can be named', # both
|
||||
'so we may see their simplicity'); # file 2
|
||||
|
||||
# test conflict during merging -- first get oldtime, then do two conflicting edits
|
||||
|
||||
sleep(2);
|
||||
|
||||
update_page('ConflictTest', $tzu_file);
|
||||
|
||||
$_ = `perl wiki.pl action=edit id=ConflictTest`;
|
||||
/name="oldtime" value="([0-9]+)"/;
|
||||
$oldtime = $1;
|
||||
|
||||
sleep(2);
|
||||
|
||||
$ENV{'REMOTE_ADDR'} = 'confusibombus';
|
||||
update_page('ConflictTest', $tao_file);
|
||||
|
||||
sleep(2);
|
||||
|
||||
$ENV{'REMOTE_ADDR'} = 'megabombus';
|
||||
test_page(update_page('ConflictTest', $lao_file,
|
||||
'', '', '', "oldtime=$oldtime"),
|
||||
q{<pre class="conflict"><<<<<<< ancestor
|
||||
=======
|
||||
The Way that can be told of is not the eternal Way;
|
||||
The name that can be named is not the eternal name.
|
||||
>>>>>>> other
|
||||
</pre>},
|
||||
q{<pre class="conflict"><<<<<<< you
|
||||
||||||| ancestor
|
||||
They both may be called deep and profound.
|
||||
Deeper and more profound,
|
||||
The door of all subtleties!
|
||||
=======
|
||||
|
||||
-- The Way of Lao-Tzu, tr. Wing-tsit Chan
|
||||
>>>>>>> other
|
||||
</pre>});
|
||||
|
||||
@Test = split('\n',<<'EOT');
|
||||
This page was changed by somebody else
|
||||
The changes conflict
|
||||
EOT
|
||||
|
||||
test_page($redirect, map { UrlEncode($_); } @Test); # test cookie!
|
||||
|
||||
# test conflict during merging without merge! -- first get oldtime, then do two conflicting edits
|
||||
|
||||
AppendStringToFile($ConfigFile, "\$ENV{'PATH'} = '';\n");
|
||||
|
||||
sleep(2);
|
||||
|
||||
update_page('ConflictTest', $lao_file);
|
||||
|
||||
$_ = `perl wiki.pl action=edit id=ConflictTest`;
|
||||
/name="oldtime" value="([0-9]+)"/;
|
||||
$oldtime = $1;
|
||||
|
||||
sleep(2);
|
||||
|
||||
$ENV{'REMOTE_ADDR'} = 'confusibombus';
|
||||
update_page('ConflictTest', $lao_file_1);
|
||||
|
||||
sleep(2);
|
||||
|
||||
# merge not available -- must look for message
|
||||
$ENV{'REMOTE_ADDR'} = 'megabombus';
|
||||
test_page(update_page('ConflictTest', $lao_file_2,
|
||||
'', '', '', "oldtime=$oldtime"),
|
||||
'The Way that can be told of is not the eternal Way', # file 2
|
||||
'so we may see their simplicity', # file 2
|
||||
'so we may see the result'); # file 2
|
||||
|
||||
test_page($redirect, map { UrlEncode($_) }
|
||||
('This page was changed by somebody else',
|
||||
'Please check whether you overwrote those changes')); # test cookie!
|
||||
|
||||
286
t/creole.t
286
t/creole.t
@@ -1,143 +1,143 @@
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 53;
|
||||
clear_pages();
|
||||
|
||||
add_module('creole.pl');
|
||||
|
||||
run_tests(split('\n',<<'EOT'));
|
||||
# one
|
||||
<ol><li>one</li></ol>
|
||||
# one
|
||||
<ol><li>one</li></ol>
|
||||
# one
|
||||
<ol><li>one</li></ol>
|
||||
# one\n# two
|
||||
<ol><li>one</li><li>two</li></ol>
|
||||
# one\n\n# two
|
||||
<ol><li>one</li><li>two</li></ol>
|
||||
- one
|
||||
<ul><li>one</li></ul>
|
||||
- one
|
||||
<ul><li>one</li></ul>
|
||||
* one
|
||||
<ul><li>one</li></ul>
|
||||
# one\n- two
|
||||
<ol><li>one</li></ol><ul><li>two</li></ul>
|
||||
# one\n - two
|
||||
<ol><li>one</li></ol><ul><li>two</li></ul>
|
||||
- Item 1\n- Item 2\n-- Item 2.1\n-- Item 2.2
|
||||
<ul><li>Item 1</li><li>Item 2<ul><li>Item 2.1</li><li>Item 2.2</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>
|
||||
this is **bold**
|
||||
this is <strong>bold</strong>
|
||||
**bold**
|
||||
<ul><li>*bold<strong></strong></li></ul>
|
||||
//italic//
|
||||
<em>italic</em>
|
||||
this is **//bold italic**//italic
|
||||
this is <strong><em>bold italic</em></strong><em>italic</em>
|
||||
//**bold italic//**bold
|
||||
<em><strong>bold italic</strong></em><strong>bold</strong>
|
||||
= foo
|
||||
= foo
|
||||
== foo
|
||||
<h2>foo</h2>
|
||||
=== foo
|
||||
<h3>foo</h3>
|
||||
==== foo
|
||||
<h4>foo</h4>
|
||||
===== foo
|
||||
<h5>foo</h5>
|
||||
====== foo
|
||||
<h6>foo</h6>
|
||||
======= foo
|
||||
<h6>foo</h6>
|
||||
== foo ==
|
||||
<h2>foo</h2>
|
||||
== foo = =
|
||||
<h2>foo =</h2>
|
||||
== foo\nbar
|
||||
<h2>foo</h2><p>bar</p>
|
||||
== [[foo]]
|
||||
<h2>[[foo]]</h2>
|
||||
foo\n\nbar
|
||||
foo<p>bar</p>
|
||||
foo\nbar
|
||||
foo<br />bar
|
||||
{{{\nfoo\n}}}
|
||||
<pre class="real">foo\n</pre>
|
||||
{{{\nfoo}}}
|
||||
<code>\nfoo</code>
|
||||
foo {{{bar}}}
|
||||
foo <code>bar</code>
|
||||
----
|
||||
<hr />
|
||||
-----
|
||||
<hr />
|
||||
-----
|
||||
<ul><li>----</li></ul>
|
||||
foo -----
|
||||
foo -----
|
||||
----\nfoo
|
||||
<hr /><p>foo</p>
|
||||
foo\n----
|
||||
foo<hr />
|
||||
EOT
|
||||
|
||||
# Mixed lists are not supported
|
||||
# - Item 1\n- Item 2\n## Item 2.1\n## Item 2.2
|
||||
# <ul><li>Item 1</li><li>Item 2<ol><li>Item 2.1</li><li>Item 2.2</li></ol></li></ul>
|
||||
|
||||
update_page('link', 'test');
|
||||
update_page('pic', 'test');
|
||||
|
||||
xpath_run_tests(split('\n',<<'EOT'));
|
||||
[[http://www.wikicreole.org/]]
|
||||
//a[@class="url http outside"][@href="http://www.wikicreole.org/"][text()="http://www.wikicreole.org/"]
|
||||
http://www.wikicreole.org/
|
||||
//a[@class="url http"][@href="http://www.wikicreole.org/"][text()="http://www.wikicreole.org/"]
|
||||
http://www.wikicreole.org/.
|
||||
//a[@class="url http"][@href="http://www.wikicreole.org/"][text()="http://www.wikicreole.org/"]
|
||||
[[http://www.wikicreole.org/|Visit the WikiCreole website]]
|
||||
//a[@class="url http outside"][@href="http://www.wikicreole.org/"][text()="Visit the WikiCreole website"]
|
||||
[[http://www.wikicreole.org/|Visit the\nWikiCreole website]]
|
||||
//a[@class="url http outside"][@href="http://www.wikicreole.org/"][text()="Visit the\nWikiCreole website"]
|
||||
[[link]]
|
||||
//a[text()="link"]
|
||||
[[link|Go to my page]]
|
||||
//a[@class="local"][@href="http://localhost/test.pl/link"][text()="Go to my page"]
|
||||
[[link|Go to\nmy page]]
|
||||
//a[@class="local"][@href="http://localhost/test.pl/link"][text()="Go to\nmy page"]
|
||||
{{pic}}
|
||||
//a[@class="image"][@href="http://localhost/test.pl/pic"][img[@class="upload"][@src="http://localhost/test.pl/download/pic"][@alt="pic"]]
|
||||
[[link|{{pic}}]]
|
||||
//a[@class="image"][@href="http://localhost/test.pl/link"][img[@class="upload"][@src="http://localhost/test.pl/download/pic"][@alt="link"]]
|
||||
[[link|{{http://example.com/}}]]
|
||||
//a[@class="image"][@href="http://localhost/test.pl/link"][img[@class="url outside"][@src="http://example.com/"][@alt="link"]]
|
||||
[[http://example.com/|{{pic}}]]
|
||||
//a[@class="image outside"][@href="http://example.com/"][img[@class="upload"][@src="http://localhost/test.pl/download/pic"][@alt="pic"]]
|
||||
{{http://example.com/}}
|
||||
//a[@class="image outside"][@href="http://example.com/"][img[@class="url outside"][@src="http://example.com/"]]
|
||||
[[http://example.com/|{{http://mu.org/}}]]
|
||||
//a[@class="image outside"][@href="http://example.com/"][img[@class="url outside"][@src="http://mu.org/"]]
|
||||
EOT
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 53;
|
||||
clear_pages();
|
||||
|
||||
add_module('creole.pl');
|
||||
|
||||
run_tests(split('\n',<<'EOT'));
|
||||
# one
|
||||
<ol><li>one</li></ol>
|
||||
# one
|
||||
<ol><li>one</li></ol>
|
||||
# one
|
||||
<ol><li>one</li></ol>
|
||||
# one\n# two
|
||||
<ol><li>one</li><li>two</li></ol>
|
||||
# one\n\n# two
|
||||
<ol><li>one</li><li>two</li></ol>
|
||||
- one
|
||||
<ul><li>one</li></ul>
|
||||
- one
|
||||
<ul><li>one</li></ul>
|
||||
* one
|
||||
<ul><li>one</li></ul>
|
||||
# one\n- two
|
||||
<ol><li>one</li></ol><ul><li>two</li></ul>
|
||||
# one\n - two
|
||||
<ol><li>one</li></ol><ul><li>two</li></ul>
|
||||
- Item 1\n- Item 2\n-- Item 2.1\n-- Item 2.2
|
||||
<ul><li>Item 1</li><li>Item 2<ul><li>Item 2.1</li><li>Item 2.2</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>
|
||||
this is **bold**
|
||||
this is <strong>bold</strong>
|
||||
**bold**
|
||||
<ul><li>*bold<strong></strong></li></ul>
|
||||
//italic//
|
||||
<em>italic</em>
|
||||
this is **//bold italic**//italic
|
||||
this is <strong><em>bold italic</em></strong><em>italic</em>
|
||||
//**bold italic//**bold
|
||||
<em><strong>bold italic</strong></em><strong>bold</strong>
|
||||
= foo
|
||||
= foo
|
||||
== foo
|
||||
<h2>foo</h2>
|
||||
=== foo
|
||||
<h3>foo</h3>
|
||||
==== foo
|
||||
<h4>foo</h4>
|
||||
===== foo
|
||||
<h5>foo</h5>
|
||||
====== foo
|
||||
<h6>foo</h6>
|
||||
======= foo
|
||||
<h6>foo</h6>
|
||||
== foo ==
|
||||
<h2>foo</h2>
|
||||
== foo = =
|
||||
<h2>foo =</h2>
|
||||
== foo\nbar
|
||||
<h2>foo</h2><p>bar</p>
|
||||
== [[foo]]
|
||||
<h2>[[foo]]</h2>
|
||||
foo\n\nbar
|
||||
foo<p>bar</p>
|
||||
foo\nbar
|
||||
foo<br />bar
|
||||
{{{\nfoo\n}}}
|
||||
<pre class="real">foo\n</pre>
|
||||
{{{\nfoo}}}
|
||||
<code>\nfoo</code>
|
||||
foo {{{bar}}}
|
||||
foo <code>bar</code>
|
||||
----
|
||||
<hr />
|
||||
-----
|
||||
<hr />
|
||||
-----
|
||||
<ul><li>----</li></ul>
|
||||
foo -----
|
||||
foo -----
|
||||
----\nfoo
|
||||
<hr /><p>foo</p>
|
||||
foo\n----
|
||||
foo<hr />
|
||||
EOT
|
||||
|
||||
# Mixed lists are not supported
|
||||
# - Item 1\n- Item 2\n## Item 2.1\n## Item 2.2
|
||||
# <ul><li>Item 1</li><li>Item 2<ol><li>Item 2.1</li><li>Item 2.2</li></ol></li></ul>
|
||||
|
||||
update_page('link', 'test');
|
||||
update_page('pic', 'test');
|
||||
|
||||
xpath_run_tests(split('\n',<<'EOT'));
|
||||
[[http://www.wikicreole.org/]]
|
||||
//a[@class="url http outside"][@href="http://www.wikicreole.org/"][text()="http://www.wikicreole.org/"]
|
||||
http://www.wikicreole.org/
|
||||
//a[@class="url http"][@href="http://www.wikicreole.org/"][text()="http://www.wikicreole.org/"]
|
||||
http://www.wikicreole.org/.
|
||||
//a[@class="url http"][@href="http://www.wikicreole.org/"][text()="http://www.wikicreole.org/"]
|
||||
[[http://www.wikicreole.org/|Visit the WikiCreole website]]
|
||||
//a[@class="url http outside"][@href="http://www.wikicreole.org/"][text()="Visit the WikiCreole website"]
|
||||
[[http://www.wikicreole.org/|Visit the\nWikiCreole website]]
|
||||
//a[@class="url http outside"][@href="http://www.wikicreole.org/"][text()="Visit the\nWikiCreole website"]
|
||||
[[link]]
|
||||
//a[text()="link"]
|
||||
[[link|Go to my page]]
|
||||
//a[@class="local"][@href="http://localhost/test.pl/link"][text()="Go to my page"]
|
||||
[[link|Go to\nmy page]]
|
||||
//a[@class="local"][@href="http://localhost/test.pl/link"][text()="Go to\nmy page"]
|
||||
{{pic}}
|
||||
//a[@class="image"][@href="http://localhost/test.pl/pic"][img[@class="upload"][@src="http://localhost/test.pl/download/pic"][@alt="pic"]]
|
||||
[[link|{{pic}}]]
|
||||
//a[@class="image"][@href="http://localhost/test.pl/link"][img[@class="upload"][@src="http://localhost/test.pl/download/pic"][@alt="link"]]
|
||||
[[link|{{http://example.com/}}]]
|
||||
//a[@class="image"][@href="http://localhost/test.pl/link"][img[@class="url outside"][@src="http://example.com/"][@alt="link"]]
|
||||
[[http://example.com/|{{pic}}]]
|
||||
//a[@class="image outside"][@href="http://example.com/"][img[@class="upload"][@src="http://localhost/test.pl/download/pic"][@alt="pic"]]
|
||||
{{http://example.com/}}
|
||||
//a[@class="image outside"][@href="http://example.com/"][img[@class="url outside"][@src="http://example.com/"]]
|
||||
[[http://example.com/|{{http://mu.org/}}]]
|
||||
//a[@class="image outside"][@href="http://example.com/"][img[@class="url outside"][@src="http://mu.org/"]]
|
||||
EOT
|
||||
|
||||
64
t/crumbs.t
64
t/crumbs.t
@@ -1,32 +1,32 @@
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 1;
|
||||
clear_pages();
|
||||
|
||||
AppendStringToFile($ConfigFile, "\$PageCluster = 'Cluster';\n");
|
||||
|
||||
add_module('crumbs.pl');
|
||||
|
||||
update_page("HomePage", "Has to do with [[Software]].");
|
||||
update_page("Software", "[[HomePage]]\n\nCheck out [[Games]].");
|
||||
update_page("Games", "[[Software]]\n\nThis is it.");
|
||||
xpath_test(get_page('Games'),
|
||||
'//p/span[@class="crumbs"]/a[@class="local"][@href="http://localhost/wiki.pl/HomePage"][text()="HomePage"]/following-sibling::text()[string()=" "]/following-sibling::a[@class="local"][@href="http://localhost/wiki.pl/Software"][text()="Software"]');
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 1;
|
||||
clear_pages();
|
||||
|
||||
AppendStringToFile($ConfigFile, "\$PageCluster = 'Cluster';\n");
|
||||
|
||||
add_module('crumbs.pl');
|
||||
|
||||
update_page("HomePage", "Has to do with [[Software]].");
|
||||
update_page("Software", "[[HomePage]]\n\nCheck out [[Games]].");
|
||||
update_page("Games", "[[Software]]\n\nThis is it.");
|
||||
xpath_test(get_page('Games'),
|
||||
'//p/span[@class="crumbs"]/a[@class="local"][@href="http://localhost/wiki.pl/HomePage"][text()="HomePage"]/following-sibling::text()[string()=" "]/following-sibling::a[@class="local"][@href="http://localhost/wiki.pl/Software"][text()="Software"]');
|
||||
|
||||
@@ -23,8 +23,6 @@ use Test::More tests => 59;
|
||||
clear_pages();
|
||||
|
||||
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;
|
||||
InitVariables();
|
||||
|
||||
# non links
|
||||
|
||||
|
||||
74
t/diff.t
74
t/diff.t
@@ -1,37 +1,37 @@
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 6;
|
||||
|
||||
clear_pages();
|
||||
|
||||
# Highlighting differences
|
||||
update_page('xah', "When we judge people in society, often, we can see people's true nature not by the official defenses and behaviors, but by looking at the statistics (past records) of their behavior and the circumstances it happens.\n"
|
||||
. "For example, when we look at the leader in human history. Great many of them have caused thousands and millions of intentional deaths. Some of these leaders are hated by many, yet great many of them are adored and admired and respected... (ok, i'm digressing...)\n");
|
||||
update_page('xah', "When we judge people in society, often, we can see people's true nature not by the official defenses and behaviors, but by looking at some subtleties, and also the statistics (past records) of their behavior and the circumstances they were in.\n"
|
||||
. "For example, when we look at leaders in history. Great many of them have caused thousands and millions of intentional deaths. Some of these leaders are hated by many, yet great many of them are adored and admired and respected... (ok, i'm digressing...)\n");
|
||||
test_page(get_page('action=browse diff=1 id=xah'),
|
||||
'<strong class="changes">it happens</strong>',
|
||||
'<strong class="changes">the leader</strong>',
|
||||
'<strong class="changes">human</strong>',
|
||||
'<strong class="changes">some subtleties, and also</strong>',
|
||||
'<strong class="changes">they were in</strong>',
|
||||
'<strong class="changes">leaders</strong>',
|
||||
);
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 6;
|
||||
|
||||
clear_pages();
|
||||
|
||||
# Highlighting differences
|
||||
update_page('xah', "When we judge people in society, often, we can see people's true nature not by the official defenses and behaviors, but by looking at the statistics (past records) of their behavior and the circumstances it happens.\n"
|
||||
. "For example, when we look at the leader in human history. Great many of them have caused thousands and millions of intentional deaths. Some of these leaders are hated by many, yet great many of them are adored and admired and respected... (ok, i'm digressing...)\n");
|
||||
update_page('xah', "When we judge people in society, often, we can see people's true nature not by the official defenses and behaviors, but by looking at some subtleties, and also the statistics (past records) of their behavior and the circumstances they were in.\n"
|
||||
. "For example, when we look at leaders in history. Great many of them have caused thousands and millions of intentional deaths. Some of these leaders are hated by many, yet great many of them are adored and admired and respected... (ok, i'm digressing...)\n");
|
||||
test_page(get_page('action=browse diff=1 id=xah'),
|
||||
'<strong class="changes">it happens</strong>',
|
||||
'<strong class="changes">the leader</strong>',
|
||||
'<strong class="changes">human</strong>',
|
||||
'<strong class="changes">some subtleties, and also</strong>',
|
||||
'<strong class="changes">they were in</strong>',
|
||||
'<strong class="changes">leaders</strong>',
|
||||
);
|
||||
|
||||
70
t/download.t
70
t/download.t
@@ -1,35 +1,35 @@
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 5;
|
||||
|
||||
clear_pages();
|
||||
|
||||
AppendStringToFile($ConfigFile, "\$UploadAllowed = 1;\n");
|
||||
|
||||
test_page_negative(get_page('HomePage'), 'logo');
|
||||
AppendStringToFile($ConfigFile, "\$LogoUrl = '/pic/logo.png';\n");
|
||||
xpath_test(get_page('HomePage'), '//a[@class="logo"]/img[@class="logo"][@src="/pic/logo.png"][@alt="[Home]"]');
|
||||
AppendStringToFile($ConfigFile, "\$LogoUrl = 'Logo';\n");
|
||||
xpath_test(get_page('HomePage'), '//a[@class="logo"]/img[@class="logo"][@src="Logo"][@alt="[Home]"]');
|
||||
update_page('Logo', "#FILE image/png\niVBORw0KGgoAAAA");
|
||||
xpath_test(get_page('HomePage'), '//a[@class="logo"]/img[@class="logo"][@src="http://localhost/wiki.pl/download/Logo"][@alt="[Home]"]');
|
||||
AppendStringToFile($ConfigFile, "\$UsePathInfo = 0;\n");
|
||||
xpath_test(get_page('HomePage'), '//a[@class="logo"]/img[@class="logo"][@src="http://localhost/wiki.pl?action=download;id=Logo"][@alt="[Home]"]');
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 5;
|
||||
|
||||
clear_pages();
|
||||
|
||||
AppendStringToFile($ConfigFile, "\$UploadAllowed = 1;\n");
|
||||
|
||||
test_page_negative(get_page('HomePage'), 'logo');
|
||||
AppendStringToFile($ConfigFile, "\$LogoUrl = '/pic/logo.png';\n");
|
||||
xpath_test(get_page('HomePage'), '//a[@class="logo"]/img[@class="logo"][@src="/pic/logo.png"][@alt="[Home]"]');
|
||||
AppendStringToFile($ConfigFile, "\$LogoUrl = 'Logo';\n");
|
||||
xpath_test(get_page('HomePage'), '//a[@class="logo"]/img[@class="logo"][@src="Logo"][@alt="[Home]"]');
|
||||
update_page('Logo', "#FILE image/png\niVBORw0KGgoAAAA");
|
||||
xpath_test(get_page('HomePage'), '//a[@class="logo"]/img[@class="logo"][@src="http://localhost/wiki.pl/download/Logo"][@alt="[Home]"]');
|
||||
AppendStringToFile($ConfigFile, "\$UsePathInfo = 0;\n");
|
||||
xpath_test(get_page('HomePage'), '//a[@class="logo"]/img[@class="logo"][@src="http://localhost/wiki.pl?action=download;id=Logo"][@alt="[Home]"]');
|
||||
|
||||
140
t/history.t
140
t/history.t
@@ -1,70 +1,70 @@
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 31;
|
||||
|
||||
clear_pages();
|
||||
|
||||
$page = get_page('action=history id=hist');
|
||||
test_page($page,
|
||||
'No other revisions available',
|
||||
'View current revision',
|
||||
'View all changes');
|
||||
test_page_negative($page,
|
||||
'View other revisions',
|
||||
'Mark this page for deletion');
|
||||
|
||||
test_page(update_page('hist', 'testing', 'test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary'),
|
||||
'testing',
|
||||
'action=history',
|
||||
'View other revisions');
|
||||
|
||||
test_page_negative(get_page('action=history id=hist'),
|
||||
'Mark this page for deletion');
|
||||
$page = get_page('action=history id=hist username=me');
|
||||
test_page($page,
|
||||
'test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary',
|
||||
'View current revision',
|
||||
'View all changes',
|
||||
'current',
|
||||
'Mark this page for deletion');
|
||||
test_page_negative($page,
|
||||
'No other revisions available',
|
||||
'View other revisions',
|
||||
'rollback');
|
||||
|
||||
test_page(update_page('hist', 'Tesla', 'Power'),
|
||||
'Tesla',
|
||||
'action=history',
|
||||
'View other revisions');
|
||||
$page = get_page('action=history id=hist username=me');
|
||||
test_page($page,
|
||||
'test summary',
|
||||
'Power',
|
||||
'View current revision',
|
||||
'View all changes',
|
||||
'current',
|
||||
'rollback',
|
||||
'action=rollback;to=',
|
||||
'Mark this page for deletion');
|
||||
test_page_negative($page,
|
||||
'Tesla',
|
||||
'No other revisions available',
|
||||
'View other revisions');
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 31;
|
||||
|
||||
clear_pages();
|
||||
|
||||
$page = get_page('action=history id=hist');
|
||||
test_page($page,
|
||||
'No other revisions available',
|
||||
'View current revision',
|
||||
'View all changes');
|
||||
test_page_negative($page,
|
||||
'View other revisions',
|
||||
'Mark this page for deletion');
|
||||
|
||||
test_page(update_page('hist', 'testing', 'test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary'),
|
||||
'testing',
|
||||
'action=history',
|
||||
'View other revisions');
|
||||
|
||||
test_page_negative(get_page('action=history id=hist'),
|
||||
'Mark this page for deletion');
|
||||
$page = get_page('action=history id=hist username=me');
|
||||
test_page($page,
|
||||
'test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary test summary',
|
||||
'View current revision',
|
||||
'View all changes',
|
||||
'current',
|
||||
'Mark this page for deletion');
|
||||
test_page_negative($page,
|
||||
'No other revisions available',
|
||||
'View other revisions',
|
||||
'rollback');
|
||||
|
||||
test_page(update_page('hist', 'Tesla', 'Power'),
|
||||
'Tesla',
|
||||
'action=history',
|
||||
'View other revisions');
|
||||
$page = get_page('action=history id=hist username=me');
|
||||
test_page($page,
|
||||
'test summary',
|
||||
'Power',
|
||||
'View current revision',
|
||||
'View all changes',
|
||||
'current',
|
||||
'rollback',
|
||||
'action=rollback;to=',
|
||||
'Mark this page for deletion');
|
||||
test_page_negative($page,
|
||||
'Tesla',
|
||||
'No other revisions available',
|
||||
'View other revisions');
|
||||
|
||||
156
t/image.t
156
t/image.t
@@ -1,78 +1,78 @@
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 23;
|
||||
|
||||
clear_pages();
|
||||
|
||||
add_module('image.pl');
|
||||
|
||||
update_page('bar', 'foo');
|
||||
update_page('InterMap', " Oddmuse http://www.emacswiki.org/cgi-bin/oddmuse.pl?\n",
|
||||
'required', 0, 1);
|
||||
|
||||
xpath_run_tests(split('\n',<<'EOT'));
|
||||
[[image:foo]]
|
||||
//a[@class="edit"][@title="Click to edit this page"][@href="http://localhost/test.pl?action=edit;id=foo;upload=1"][text()="?"]
|
||||
[[image:bar]]
|
||||
//a[@class="image"][@href="http://localhost/test.pl/bar"]/img[@class="upload"][@src="http://localhost/test.pl/download/bar"][@alt="bar"]
|
||||
[[image:bar|alternative text]]
|
||||
//a[@class="image"][@href="http://localhost/test.pl/bar"]/img[@class="upload"][@src="http://localhost/test.pl/download/bar"][@alt="alternative text"]
|
||||
[[image:bar|alternative text|foo]]
|
||||
//a[@class="image"][@href="http://localhost/test.pl/foo"]/img[@class="upload"][@title="alternative text"][@src="http://localhost/test.pl/download/bar"][@alt="alternative text"]
|
||||
[[image/left:bar|alternative text|foo]]
|
||||
//a[@class="image left"][@href="http://localhost/test.pl/foo"]/img[@class="upload"][@title="alternative text"][@src="http://localhost/test.pl/download/bar"][@alt="alternative text"]
|
||||
[[image:http://example.org/wiki?a=1&b=2]]
|
||||
//a[@class="image outside"][@href="http://example.org/wiki?a=1&b=2"]/img[@class="upload"][@title=""][@src="http://example.org/wiki?a=1&b=2"][@alt=""]
|
||||
[[image/left/small:bar|alternative text]]
|
||||
//a[@class="image left small"][@href="http://localhost/test.pl/bar"]/img[@class="upload"][@title="alternative text"][@src="http://localhost/test.pl/download/bar"][@alt="alternative text"]
|
||||
[[image:http://example.org/wiki?a=1&b=2|foo|http://example.org/wiki?a=4&b=3]]
|
||||
//a[@class="image outside"][@href="http://example.org/wiki?a=4&b=3"]/img[@class="upload"][@title="foo"][@src="http://example.org/wiki?a=1&b=2"][@alt="foo"]
|
||||
[[image/right:bar|alternative text]]
|
||||
//a[@class="image right"][@href="http://localhost/test.pl/bar"]/img[@class="upload"][@title="alternative text"][@src="http://localhost/test.pl/download/bar"][@alt="alternative text"]
|
||||
[[image/left:bar|alternative text|http://www.foo.com/]]
|
||||
//a[@class="image left outside"][@href="http://www.foo.com/"]/img[@class="upload"][@title="alternative text"][@src="http://localhost/test.pl/download/bar"][@alt="alternative text"]
|
||||
[[image/left/small:bar|alternative text|http://www.foo.com/|more text|http://www.bar.com/]]
|
||||
//a[@class="image left small outside"][@href="http://www.foo.com/"][img[@class="upload"][@title="alternative text"][@src="http://localhost/test.pl/download/bar"][@alt="alternative text"]]/following-sibling::br/following-sibling::span[@class="caption"]/a[@class="image left small outside"][@href="http://www.bar.com/"][text()="more text"]
|
||||
[[image/left/small:bar|alternative text|http://www.foo.com/|more text|bar]]
|
||||
//a[@class="image left small outside"][@href="http://www.foo.com/"][img[@class="upload"][@title="alternative text"][@src="http://localhost/test.pl/download/bar"][@alt="alternative text"]]/following-sibling::br/following-sibling::span[@class="caption"]/a[@class="image left small"][@href="http://localhost/test.pl/bar"][text()="more text"]
|
||||
[[image:http://www.example.com/]]
|
||||
//a[@class="image outside"][@href="http://www.example.com/"]/img[@class="upload"][@title=""][@src="http://www.example.com/"][@alt=""]
|
||||
[[image external:foo]]
|
||||
//a[@class="image"][@href="/images/foo"]/img[@class="upload"][@title=""][@src="/images/foo"][@alt=""]
|
||||
[[image external:foo bar]]
|
||||
//a[@class="image"][@href="/images/foo%20bar"]/img[@class="upload"][@title=""][@src="/images/foo%20bar"][@alt=""]
|
||||
[[image external:foo|moo]]
|
||||
//a[@class="image"][@href="/images/foo"]/img[@class="upload"][@title="moo"][@src="/images/foo"][@alt="moo"]
|
||||
[[image external:foo|moo||the caption]]
|
||||
//div[@class="image"]/a[@class="image"][@href="/images/foo"][img[@class="upload"][@title="moo"][@src="/images/foo"][@alt="moo"]]/following-sibling::br/following-sibling::span[@class="caption"][text()="the caption"]
|
||||
[[image:foo/bar|moo||the caption]]
|
||||
//div[@class="image"]/a[@class="image"][@href="/images/foo/bar"][img[@class="upload"][@title="moo"][@src="/images/foo/bar"][@alt="moo"]]/following-sibling::br/following-sibling::span[@class="caption"][text()="the caption"]
|
||||
[[image:foo/bar|moo|baz|the caption]]
|
||||
//div[@class="image"]/a[@class="image"][@href="http://localhost/test.pl/baz"][img[@class="upload"][@title="moo"][@src="/images/foo/bar"][@alt="moo"]]/following-sibling::br/following-sibling::span[@class="caption"][text()="the caption"]
|
||||
[[image:Oddmuse:foo/bar|moo|Oddmuse:baz/zz|the caption]]
|
||||
//div[@class="image"]/a[@class="image inter Oddmuse"][@href="http://www.emacswiki.org/cgi-bin/oddmuse.pl?baz/zz"][img[@class="upload"][@title="moo"][@src="http://www.emacswiki.org/cgi-bin/oddmuse.pl?foo/bar"][@alt="moo"]]/following-sibling::br/following-sibling::span[@class="caption"][text()="the caption"]
|
||||
[[image:Oddmuse:foo/bar|moo|Oddmuse:baz/zz|the caption|Oddmuse:quux]]
|
||||
//div[@class="image"]/a[@class="image inter Oddmuse"][@href="http://www.emacswiki.org/cgi-bin/oddmuse.pl?baz/zz"][img[@class="upload"][@title="moo"][@src="http://www.emacswiki.org/cgi-bin/oddmuse.pl?foo/bar"][@alt="moo"]]/following-sibling::br/following-sibling::span[@class="caption"][a[@class="image inter Oddmuse"][@href="http://www.emacswiki.org/cgi-bin/oddmuse.pl?quux"][text()="the caption"]]
|
||||
[[image:Oddmuse:the foo|moo|Oddmuse:the baz|the caption|Oddmuse:the quux]]
|
||||
//div[@class="image"]/a[@class="image inter Oddmuse"][@href="http://www.emacswiki.org/cgi-bin/oddmuse.pl?the%20baz"][img[@class="upload"][@title="moo"][@src="http://www.emacswiki.org/cgi-bin/oddmuse.pl?the%20foo"][@alt="moo"]]/following-sibling::br/following-sibling::span[@class="caption"][a[@class="image inter Oddmuse"][@href="http://www.emacswiki.org/cgi-bin/oddmuse.pl?the%20quux"][text()="the caption"]]
|
||||
[[image:Oddmuse:Alex Schröder]]
|
||||
//div/a[@class="image inter Oddmuse"][@href="http://www.emacswiki.org/cgi-bin/oddmuse.pl?Alex%20Schr%c3%b6der"][img[@class="upload"][@src="http://www.emacswiki.org/cgi-bin/oddmuse.pl?Alex%20Schr%c3%b6der"]]
|
||||
EOT
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 23;
|
||||
|
||||
clear_pages();
|
||||
|
||||
add_module('image.pl');
|
||||
|
||||
update_page('bar', 'foo');
|
||||
update_page('InterMap', " Oddmuse http://www.emacswiki.org/cgi-bin/oddmuse.pl?\n",
|
||||
'required', 0, 1);
|
||||
|
||||
xpath_run_tests(split('\n',<<'EOT'));
|
||||
[[image:foo]]
|
||||
//a[@class="edit"][@title="Click to edit this page"][@href="http://localhost/test.pl?action=edit;id=foo;upload=1"][text()="?"]
|
||||
[[image:bar]]
|
||||
//a[@class="image"][@href="http://localhost/test.pl/bar"]/img[@class="upload"][@src="http://localhost/test.pl/download/bar"][@alt="bar"]
|
||||
[[image:bar|alternative text]]
|
||||
//a[@class="image"][@href="http://localhost/test.pl/bar"]/img[@class="upload"][@src="http://localhost/test.pl/download/bar"][@alt="alternative text"]
|
||||
[[image:bar|alternative text|foo]]
|
||||
//a[@class="image"][@href="http://localhost/test.pl/foo"]/img[@class="upload"][@title="alternative text"][@src="http://localhost/test.pl/download/bar"][@alt="alternative text"]
|
||||
[[image/left:bar|alternative text|foo]]
|
||||
//a[@class="image left"][@href="http://localhost/test.pl/foo"]/img[@class="upload"][@title="alternative text"][@src="http://localhost/test.pl/download/bar"][@alt="alternative text"]
|
||||
[[image:http://example.org/wiki?a=1&b=2]]
|
||||
//a[@class="image outside"][@href="http://example.org/wiki?a=1&b=2"]/img[@class="upload"][@title=""][@src="http://example.org/wiki?a=1&b=2"][@alt=""]
|
||||
[[image/left/small:bar|alternative text]]
|
||||
//a[@class="image left small"][@href="http://localhost/test.pl/bar"]/img[@class="upload"][@title="alternative text"][@src="http://localhost/test.pl/download/bar"][@alt="alternative text"]
|
||||
[[image:http://example.org/wiki?a=1&b=2|foo|http://example.org/wiki?a=4&b=3]]
|
||||
//a[@class="image outside"][@href="http://example.org/wiki?a=4&b=3"]/img[@class="upload"][@title="foo"][@src="http://example.org/wiki?a=1&b=2"][@alt="foo"]
|
||||
[[image/right:bar|alternative text]]
|
||||
//a[@class="image right"][@href="http://localhost/test.pl/bar"]/img[@class="upload"][@title="alternative text"][@src="http://localhost/test.pl/download/bar"][@alt="alternative text"]
|
||||
[[image/left:bar|alternative text|http://www.foo.com/]]
|
||||
//a[@class="image left outside"][@href="http://www.foo.com/"]/img[@class="upload"][@title="alternative text"][@src="http://localhost/test.pl/download/bar"][@alt="alternative text"]
|
||||
[[image/left/small:bar|alternative text|http://www.foo.com/|more text|http://www.bar.com/]]
|
||||
//a[@class="image left small outside"][@href="http://www.foo.com/"][img[@class="upload"][@title="alternative text"][@src="http://localhost/test.pl/download/bar"][@alt="alternative text"]]/following-sibling::br/following-sibling::span[@class="caption"]/a[@class="image left small outside"][@href="http://www.bar.com/"][text()="more text"]
|
||||
[[image/left/small:bar|alternative text|http://www.foo.com/|more text|bar]]
|
||||
//a[@class="image left small outside"][@href="http://www.foo.com/"][img[@class="upload"][@title="alternative text"][@src="http://localhost/test.pl/download/bar"][@alt="alternative text"]]/following-sibling::br/following-sibling::span[@class="caption"]/a[@class="image left small"][@href="http://localhost/test.pl/bar"][text()="more text"]
|
||||
[[image:http://www.example.com/]]
|
||||
//a[@class="image outside"][@href="http://www.example.com/"]/img[@class="upload"][@title=""][@src="http://www.example.com/"][@alt=""]
|
||||
[[image external:foo]]
|
||||
//a[@class="image"][@href="/images/foo"]/img[@class="upload"][@title=""][@src="/images/foo"][@alt=""]
|
||||
[[image external:foo bar]]
|
||||
//a[@class="image"][@href="/images/foo%20bar"]/img[@class="upload"][@title=""][@src="/images/foo%20bar"][@alt=""]
|
||||
[[image external:foo|moo]]
|
||||
//a[@class="image"][@href="/images/foo"]/img[@class="upload"][@title="moo"][@src="/images/foo"][@alt="moo"]
|
||||
[[image external:foo|moo||the caption]]
|
||||
//div[@class="image"]/a[@class="image"][@href="/images/foo"][img[@class="upload"][@title="moo"][@src="/images/foo"][@alt="moo"]]/following-sibling::br/following-sibling::span[@class="caption"][text()="the caption"]
|
||||
[[image:foo/bar|moo||the caption]]
|
||||
//div[@class="image"]/a[@class="image"][@href="/images/foo/bar"][img[@class="upload"][@title="moo"][@src="/images/foo/bar"][@alt="moo"]]/following-sibling::br/following-sibling::span[@class="caption"][text()="the caption"]
|
||||
[[image:foo/bar|moo|baz|the caption]]
|
||||
//div[@class="image"]/a[@class="image"][@href="http://localhost/test.pl/baz"][img[@class="upload"][@title="moo"][@src="/images/foo/bar"][@alt="moo"]]/following-sibling::br/following-sibling::span[@class="caption"][text()="the caption"]
|
||||
[[image:Oddmuse:foo/bar|moo|Oddmuse:baz/zz|the caption]]
|
||||
//div[@class="image"]/a[@class="image inter Oddmuse"][@href="http://www.emacswiki.org/cgi-bin/oddmuse.pl?baz/zz"][img[@class="upload"][@title="moo"][@src="http://www.emacswiki.org/cgi-bin/oddmuse.pl?foo/bar"][@alt="moo"]]/following-sibling::br/following-sibling::span[@class="caption"][text()="the caption"]
|
||||
[[image:Oddmuse:foo/bar|moo|Oddmuse:baz/zz|the caption|Oddmuse:quux]]
|
||||
//div[@class="image"]/a[@class="image inter Oddmuse"][@href="http://www.emacswiki.org/cgi-bin/oddmuse.pl?baz/zz"][img[@class="upload"][@title="moo"][@src="http://www.emacswiki.org/cgi-bin/oddmuse.pl?foo/bar"][@alt="moo"]]/following-sibling::br/following-sibling::span[@class="caption"][a[@class="image inter Oddmuse"][@href="http://www.emacswiki.org/cgi-bin/oddmuse.pl?quux"][text()="the caption"]]
|
||||
[[image:Oddmuse:the foo|moo|Oddmuse:the baz|the caption|Oddmuse:the quux]]
|
||||
//div[@class="image"]/a[@class="image inter Oddmuse"][@href="http://www.emacswiki.org/cgi-bin/oddmuse.pl?the%20baz"][img[@class="upload"][@title="moo"][@src="http://www.emacswiki.org/cgi-bin/oddmuse.pl?the%20foo"][@alt="moo"]]/following-sibling::br/following-sibling::span[@class="caption"][a[@class="image inter Oddmuse"][@href="http://www.emacswiki.org/cgi-bin/oddmuse.pl?the%20quux"][text()="the caption"]]
|
||||
[[image:Oddmuse:Alex Schröder]]
|
||||
//div/a[@class="image inter Oddmuse"][@href="http://www.emacswiki.org/cgi-bin/oddmuse.pl?Alex%20Schr%c3%b6der"][img[@class="upload"][@src="http://www.emacswiki.org/cgi-bin/oddmuse.pl?Alex%20Schr%c3%b6der"]]
|
||||
EOT
|
||||
|
||||
74
t/irc.t
74
t/irc.t
@@ -1,37 +1,37 @@
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 5;
|
||||
clear_pages();
|
||||
|
||||
add_module('irc.pl');
|
||||
|
||||
run_tests(split('\n',<<'EOT'));
|
||||
<kensanata> foo
|
||||
<dl class="irc"><dt><b>kensanata</b></dt><dd>foo</dd></dl>
|
||||
16:45 <kensanata> foo
|
||||
<dl class="irc"><dt><span class="time">16:45 </span><b>kensanata</b></dt><dd>foo</dd></dl>
|
||||
[16:45] <kensanata> foo
|
||||
<dl class="irc"><dt><span class="time">16:45 </span><b>kensanata</b></dt><dd>foo</dd></dl>
|
||||
16:45am <kensanata> foo
|
||||
<dl class="irc"><dt><span class="time">16:45am </span><b>kensanata</b></dt><dd>foo</dd></dl>
|
||||
[16:45am] <kensanata> foo
|
||||
<dl class="irc"><dt><span class="time">16:45am </span><b>kensanata</b></dt><dd>foo</dd></dl>
|
||||
EOT
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 5;
|
||||
clear_pages();
|
||||
|
||||
add_module('irc.pl');
|
||||
|
||||
run_tests(split('\n',<<'EOT'));
|
||||
<kensanata> foo
|
||||
<dl class="irc"><dt><b>kensanata</b></dt><dd>foo</dd></dl>
|
||||
16:45 <kensanata> foo
|
||||
<dl class="irc"><dt><span class="time">16:45 </span><b>kensanata</b></dt><dd>foo</dd></dl>
|
||||
[16:45] <kensanata> foo
|
||||
<dl class="irc"><dt><span class="time">16:45 </span><b>kensanata</b></dt><dd>foo</dd></dl>
|
||||
16:45am <kensanata> foo
|
||||
<dl class="irc"><dt><span class="time">16:45am </span><b>kensanata</b></dt><dd>foo</dd></dl>
|
||||
[16:45am] <kensanata> foo
|
||||
<dl class="irc"><dt><span class="time">16:45am </span><b>kensanata</b></dt><dd>foo</dd></dl>
|
||||
EOT
|
||||
|
||||
72
t/link-all.t
72
t/link-all.t
@@ -1,36 +1,36 @@
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 2;
|
||||
|
||||
clear_pages();
|
||||
|
||||
add_module('link-all.pl');
|
||||
|
||||
update_page('foo', 'link-all for bar');
|
||||
|
||||
xpath_test(get_page('action=browse define=1 id=foo'),
|
||||
'//a[@class="edit"][@title="Click to edit this page"][@href="http://localhost/wiki.pl?action=edit;id=bar"][text()="bar"]');
|
||||
|
||||
|
||||
xpath_run_tests(split('\n',<<'EOT'));
|
||||
testing foo.
|
||||
//a[@class="local"][@href="http://localhost/test.pl/foo"][text()="foo"]
|
||||
EOT
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 2;
|
||||
|
||||
clear_pages();
|
||||
|
||||
add_module('link-all.pl');
|
||||
|
||||
update_page('foo', 'link-all for bar');
|
||||
|
||||
xpath_test(get_page('action=browse define=1 id=foo'),
|
||||
'//a[@class="edit"][@title="Click to edit this page"][@href="http://localhost/wiki.pl?action=edit;id=bar"][text()="bar"]');
|
||||
|
||||
|
||||
xpath_run_tests(split('\n',<<'EOT'));
|
||||
testing foo.
|
||||
//a[@class="local"][@href="http://localhost/test.pl/foo"][text()="foo"]
|
||||
EOT
|
||||
|
||||
@@ -1,43 +1,43 @@
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 8;
|
||||
clear_pages();
|
||||
|
||||
add_module('tables-long.pl');
|
||||
|
||||
run_tests(split('\n',<<'EOT'));
|
||||
<table a,b>\na=a\nb=b\na=one\nb=two
|
||||
<table class="user long"><tr><th>a</th><th>b</th></tr><tr><td>one</td><td>two</td></tr></table>
|
||||
<table a,b>\na=a\nb=b\na=one\nb=two\n----
|
||||
<table class="user long"><tr><th>a</th><th>b</th></tr><tr><td>one</td><td>two</td></tr></table>
|
||||
<table a,b>\na=a\nb=b\na=one\nb=two\n----\n\nDone.
|
||||
<table class="user long"><tr><th>a</th><th>b</th></tr><tr><td>one</td><td>two</td></tr></table><p>Done.</p>
|
||||
Here is a table:\n<table a,b>\na=a\nb=b\na=one\ntwo\nand a half\nb=three\na=foo\nb=bar\n----\n\nDone.\n<table foo,bar>\nfoo=test\nbar=test as well\nfoo=what we test\n----\nthe end.
|
||||
Here is a table: <table class="user long"><tr><th>a</th><th>b</th></tr><tr><td>one two and a half</td><td>three</td></tr><tr><td>foo</td><td>bar</td></tr></table><p>Done. </p><table class="user long"><tr><th>test</th><th>test as well</th></tr><tr><td colspan="2">what we test</td></tr></table><p>the end.</p>
|
||||
<table a,b>\na=a\nb=b\na=one\nb/2=odd\na=three
|
||||
<table class="user long"><tr><th>a</th><th>b</th></tr><tr><td>one</td><td rowspan="2">odd</td></tr><tr><td>three</td></tr></table>
|
||||
<table a,b,c>\na=a\nb=b\nc=c\na=one\nb/2=odd\nc=two\na=three\nc=four
|
||||
<table class="user long"><tr><th>a</th><th>b</th><th>c</th></tr><tr><td>one</td><td rowspan="2">odd</td><td>two</td></tr><tr><td>three</td><td>four</td></tr></table>
|
||||
<table a,b,c>\na=a\nb=b\nc=c\na=one\nb=two\nc/2=numbers\na=three\n
|
||||
<table class="user long"><tr><th>a</th><th>b</th><th>c</th></tr><tr><td>one</td><td>two</td><td rowspan="2">numbers</td></tr><tr><td colspan="2">three</td></tr></table>
|
||||
<table a, b, c>\na:0\nb:1\nc:00\n----\n
|
||||
<table class="user long"><tr><th>0</th><th>1</th><th>00</th></tr></table>
|
||||
EOT
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 8;
|
||||
clear_pages();
|
||||
|
||||
add_module('tables-long.pl');
|
||||
|
||||
run_tests(split('\n',<<'EOT'));
|
||||
<table a,b>\na=a\nb=b\na=one\nb=two
|
||||
<table class="user long"><tr><th>a</th><th>b</th></tr><tr><td>one</td><td>two</td></tr></table>
|
||||
<table a,b>\na=a\nb=b\na=one\nb=two\n----
|
||||
<table class="user long"><tr><th>a</th><th>b</th></tr><tr><td>one</td><td>two</td></tr></table>
|
||||
<table a,b>\na=a\nb=b\na=one\nb=two\n----\n\nDone.
|
||||
<table class="user long"><tr><th>a</th><th>b</th></tr><tr><td>one</td><td>two</td></tr></table><p>Done.</p>
|
||||
Here is a table:\n<table a,b>\na=a\nb=b\na=one\ntwo\nand a half\nb=three\na=foo\nb=bar\n----\n\nDone.\n<table foo,bar>\nfoo=test\nbar=test as well\nfoo=what we test\n----\nthe end.
|
||||
Here is a table: <table class="user long"><tr><th>a</th><th>b</th></tr><tr><td>one two and a half</td><td>three</td></tr><tr><td>foo</td><td>bar</td></tr></table><p>Done. </p><table class="user long"><tr><th>test</th><th>test as well</th></tr><tr><td colspan="2">what we test</td></tr></table><p>the end.</p>
|
||||
<table a,b>\na=a\nb=b\na=one\nb/2=odd\na=three
|
||||
<table class="user long"><tr><th>a</th><th>b</th></tr><tr><td>one</td><td rowspan="2">odd</td></tr><tr><td>three</td></tr></table>
|
||||
<table a,b,c>\na=a\nb=b\nc=c\na=one\nb/2=odd\nc=two\na=three\nc=four
|
||||
<table class="user long"><tr><th>a</th><th>b</th><th>c</th></tr><tr><td>one</td><td rowspan="2">odd</td><td>two</td></tr><tr><td>three</td><td>four</td></tr></table>
|
||||
<table a,b,c>\na=a\nb=b\nc=c\na=one\nb=two\nc/2=numbers\na=three\n
|
||||
<table class="user long"><tr><th>a</th><th>b</th><th>c</th></tr><tr><td>one</td><td>two</td><td rowspan="2">numbers</td></tr><tr><td colspan="2">three</td></tr></table>
|
||||
<table a, b, c>\na:0\nb:1\nc:00\n----\n
|
||||
<table class="user long"><tr><th>0</th><th>1</th><th>00</th></tr></table>
|
||||
EOT
|
||||
|
||||
126
t/major.t
126
t/major.t
@@ -1,63 +1,63 @@
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 64;
|
||||
|
||||
clear_pages();
|
||||
|
||||
# start with minor
|
||||
update_page('bar', 'one', '', 1); # lastmajor is undef
|
||||
test_page(get_page('action=browse id=bar diff=1'), 'No diff available', 'one', 'Last major edit',
|
||||
'diff=1;id=bar;diffrevision=1');
|
||||
test_page(get_page('action=browse id=bar diff=2'), 'No diff available', 'one', 'Last edit');
|
||||
update_page('bar', 'two', '', 1); # lastmajor is undef
|
||||
test_page(get_page('action=browse id=bar diff=1'), 'No diff available', 'two', 'Last major edit',
|
||||
'diff=1;id=bar;diffrevision=1');
|
||||
test_page(get_page('action=browse id=bar diff=2'), 'one', 'two', 'Last edit');
|
||||
update_page('bar', 'three'); # lastmajor is 3
|
||||
test_page(get_page('action=browse id=bar diff=1'), 'two', 'three', 'Last edit');
|
||||
test_page(get_page('action=browse id=bar diff=2'), 'two', 'three', 'Last edit');
|
||||
update_page('bar', 'four'); # lastmajor is 4
|
||||
test_page(get_page('action=browse id=bar diff=1'), 'three', 'four', 'Last edit');
|
||||
test_page(get_page('action=browse id=bar diff=2'), 'three', 'four', 'Last edit');
|
||||
# start with major
|
||||
|
||||
clear_pages();
|
||||
|
||||
update_page('bla', 'one'); # lastmajor is 1
|
||||
test_page(get_page('action=browse id=bla diff=1'), 'No diff available', 'one', 'Last edit');
|
||||
test_page(get_page('action=browse id=bla diff=2'), 'No diff available', 'one', 'Last edit');
|
||||
update_page('bla', 'two', '', 1); # lastmajor is 1
|
||||
test_page(get_page('action=browse id=bla diff=1'), 'No diff available', 'two', 'Last major edit',
|
||||
'diff=1;id=bla;diffrevision=1');
|
||||
test_page(get_page('action=browse id=bla diff=2'), 'one', 'two', 'Last edit');
|
||||
update_page('bla', 'three'); # lastmajor is 3
|
||||
test_page(get_page('action=browse id=bla diff=1'), 'two', 'three', 'Last edit');
|
||||
test_page(get_page('action=browse id=bla diff=2'), 'two', 'three', 'Last edit');
|
||||
update_page('bla', 'four', '', 1); # lastmajor is 3
|
||||
test_page(get_page('action=browse id=bla diff=1'), 'two', 'three', 'Last major edit',
|
||||
'diff=1;id=bla;diffrevision=3');
|
||||
test_page(get_page('action=browse id=bla diff=2'), 'three', 'four', 'Last edit');
|
||||
update_page('bla', 'five'); # lastmajor is 5
|
||||
test_page(get_page('action=browse id=bla diff=1'), 'four', 'five', 'Last edit');
|
||||
test_page(get_page('action=browse id=bla diff=2'), 'four', 'five', 'Last edit');
|
||||
update_page('bla', 'six'); # lastmajor is 6
|
||||
test_page(get_page('action=browse id=bla diff=1'), 'five', 'six', 'Last edit');
|
||||
test_page(get_page('action=browse id=bla diff=2'), 'five', 'six', 'Last edit');
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 64;
|
||||
|
||||
clear_pages();
|
||||
|
||||
# start with minor
|
||||
update_page('bar', 'one', '', 1); # lastmajor is undef
|
||||
test_page(get_page('action=browse id=bar diff=1'), 'No diff available', 'one', 'Last major edit',
|
||||
'diff=1;id=bar;diffrevision=1');
|
||||
test_page(get_page('action=browse id=bar diff=2'), 'No diff available', 'one', 'Last edit');
|
||||
update_page('bar', 'two', '', 1); # lastmajor is undef
|
||||
test_page(get_page('action=browse id=bar diff=1'), 'No diff available', 'two', 'Last major edit',
|
||||
'diff=1;id=bar;diffrevision=1');
|
||||
test_page(get_page('action=browse id=bar diff=2'), 'one', 'two', 'Last edit');
|
||||
update_page('bar', 'three'); # lastmajor is 3
|
||||
test_page(get_page('action=browse id=bar diff=1'), 'two', 'three', 'Last edit');
|
||||
test_page(get_page('action=browse id=bar diff=2'), 'two', 'three', 'Last edit');
|
||||
update_page('bar', 'four'); # lastmajor is 4
|
||||
test_page(get_page('action=browse id=bar diff=1'), 'three', 'four', 'Last edit');
|
||||
test_page(get_page('action=browse id=bar diff=2'), 'three', 'four', 'Last edit');
|
||||
# start with major
|
||||
|
||||
clear_pages();
|
||||
|
||||
update_page('bla', 'one'); # lastmajor is 1
|
||||
test_page(get_page('action=browse id=bla diff=1'), 'No diff available', 'one', 'Last edit');
|
||||
test_page(get_page('action=browse id=bla diff=2'), 'No diff available', 'one', 'Last edit');
|
||||
update_page('bla', 'two', '', 1); # lastmajor is 1
|
||||
test_page(get_page('action=browse id=bla diff=1'), 'No diff available', 'two', 'Last major edit',
|
||||
'diff=1;id=bla;diffrevision=1');
|
||||
test_page(get_page('action=browse id=bla diff=2'), 'one', 'two', 'Last edit');
|
||||
update_page('bla', 'three'); # lastmajor is 3
|
||||
test_page(get_page('action=browse id=bla diff=1'), 'two', 'three', 'Last edit');
|
||||
test_page(get_page('action=browse id=bla diff=2'), 'two', 'three', 'Last edit');
|
||||
update_page('bla', 'four', '', 1); # lastmajor is 3
|
||||
test_page(get_page('action=browse id=bla diff=1'), 'two', 'three', 'Last major edit',
|
||||
'diff=1;id=bla;diffrevision=3');
|
||||
test_page(get_page('action=browse id=bla diff=2'), 'three', 'four', 'Last edit');
|
||||
update_page('bla', 'five'); # lastmajor is 5
|
||||
test_page(get_page('action=browse id=bla diff=1'), 'four', 'five', 'Last edit');
|
||||
test_page(get_page('action=browse id=bla diff=2'), 'four', 'five', 'Last edit');
|
||||
update_page('bla', 'six'); # lastmajor is 6
|
||||
test_page(get_page('action=browse id=bla diff=1'), 'five', 'six', 'Last edit');
|
||||
test_page(get_page('action=browse id=bla diff=2'), 'five', 'six', 'Last edit');
|
||||
|
||||
288
t/markup.t
288
t/markup.t
File diff suppressed because one or more lines are too long
114
t/moin.t
114
t/moin.t
@@ -1,57 +1,57 @@
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 15;
|
||||
clear_pages();
|
||||
|
||||
add_module('moin.pl');
|
||||
|
||||
xpath_run_tests(split('\n',<<'EOT'));
|
||||
foo[[BR]]bar
|
||||
//text()[string()="foo"]/following-sibling::br/following-sibling::text()[string()="bar"]
|
||||
''foo''
|
||||
//em[text()="foo"]
|
||||
'''bar'''
|
||||
//strong[text()="bar"]
|
||||
[[foo bar]]
|
||||
//a[@class="edit"][@title="Click to edit this page"][@href="http://localhost/test.pl?action=edit;id=foo_bar"][text()="?"]
|
||||
["foo bar"]
|
||||
//a[@class="edit"][@title="Click to edit this page"][@href="http://localhost/test.pl?action=edit;id=foo_bar"][text()="?"]
|
||||
* one\n* two\n** two.one
|
||||
//ul/li[text()="one"]/following-sibling::li/text()[string()="two"]/following-sibling::ul/li[text()="two.one"]
|
||||
* one\n * two\n * two.one
|
||||
//ul/li[text()="one"]/following-sibling::li/text()[string()="two"]/following-sibling::ul/li[text()="two.one"]
|
||||
* one\n * one.one\n * two
|
||||
//ul/li/text()[string()="one"]/following-sibling::ul/li[text()="one.one"]/../../following-sibling::li[text()="two"]
|
||||
* one\n * one.one\n * two
|
||||
//ul/li/text()[string()="one"]/following-sibling::ul/li[text()="one.one"]/../../following-sibling::li[text()="two"]
|
||||
1. one\n 1. two\n 1. two.one
|
||||
//ol/li[text()="one"]/following-sibling::li/text()[string()="two"]/following-sibling::ol/li[text()="two.one"]
|
||||
one\n one.one\n two
|
||||
//dl[@class="quote"]/dd/text()[normalize-space(string())="one"]/following-sibling::dl/dd[normalize-space(text())="one.one"]/../../following-sibling::dd[text()="two"]
|
||||
* one\n more\n * two\n more
|
||||
//ul/li[normalize-space(text())="one more"]/following-sibling::li[normalize-space(text())="two more"]
|
||||
* one\n more\n * two\n more
|
||||
//ul/li/text()[normalize-space(string())="one more"]/following-sibling::ul/li[normalize-space(text())="two more"]
|
||||
one\n more\n two\n more
|
||||
//dl[@class="quote"]/dd/text()[normalize-space(string())="one more"]/following-sibling::dl/dd[normalize-space(text())="two more"]
|
||||
{{{\n[[foo bar]]\n}}}
|
||||
//pre[@class="real"][text()="[[foo bar]]\n"]
|
||||
EOT
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 15;
|
||||
clear_pages();
|
||||
|
||||
add_module('moin.pl');
|
||||
|
||||
xpath_run_tests(split('\n',<<'EOT'));
|
||||
foo[[BR]]bar
|
||||
//text()[string()="foo"]/following-sibling::br/following-sibling::text()[string()="bar"]
|
||||
''foo''
|
||||
//em[text()="foo"]
|
||||
'''bar'''
|
||||
//strong[text()="bar"]
|
||||
[[foo bar]]
|
||||
//a[@class="edit"][@title="Click to edit this page"][@href="http://localhost/test.pl?action=edit;id=foo_bar"][text()="?"]
|
||||
["foo bar"]
|
||||
//a[@class="edit"][@title="Click to edit this page"][@href="http://localhost/test.pl?action=edit;id=foo_bar"][text()="?"]
|
||||
* one\n* two\n** two.one
|
||||
//ul/li[text()="one"]/following-sibling::li/text()[string()="two"]/following-sibling::ul/li[text()="two.one"]
|
||||
* one\n * two\n * two.one
|
||||
//ul/li[text()="one"]/following-sibling::li/text()[string()="two"]/following-sibling::ul/li[text()="two.one"]
|
||||
* one\n * one.one\n * two
|
||||
//ul/li/text()[string()="one"]/following-sibling::ul/li[text()="one.one"]/../../following-sibling::li[text()="two"]
|
||||
* one\n * one.one\n * two
|
||||
//ul/li/text()[string()="one"]/following-sibling::ul/li[text()="one.one"]/../../following-sibling::li[text()="two"]
|
||||
1. one\n 1. two\n 1. two.one
|
||||
//ol/li[text()="one"]/following-sibling::li/text()[string()="two"]/following-sibling::ol/li[text()="two.one"]
|
||||
one\n one.one\n two
|
||||
//dl[@class="quote"]/dd/text()[normalize-space(string())="one"]/following-sibling::dl/dd[normalize-space(text())="one.one"]/../../following-sibling::dd[text()="two"]
|
||||
* one\n more\n * two\n more
|
||||
//ul/li[normalize-space(text())="one more"]/following-sibling::li[normalize-space(text())="two more"]
|
||||
* one\n more\n * two\n more
|
||||
//ul/li/text()[normalize-space(string())="one more"]/following-sibling::ul/li[normalize-space(text())="two more"]
|
||||
one\n more\n two\n more
|
||||
//dl[@class="quote"]/dd/text()[normalize-space(string())="one more"]/following-sibling::dl/dd[normalize-space(text())="two more"]
|
||||
{{{\n[[foo bar]]\n}}}
|
||||
//pre[@class="real"][text()="[[foo bar]]\n"]
|
||||
EOT
|
||||
|
||||
@@ -1,29 +1,29 @@
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 4;
|
||||
|
||||
clear_pages();
|
||||
|
||||
update_page('.dotfile', 'old content', 'older summary');
|
||||
update_page('.dotfile', 'some content', 'some summary');
|
||||
test_page(get_page('.dotfile'), 'some content');
|
||||
test_page(get_page('action=browse id=.dotfile revision=1'), 'old content');
|
||||
test_page(get_page('action=history id=.dotfile'), 'older summary', 'some summary');
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 4;
|
||||
|
||||
clear_pages();
|
||||
|
||||
update_page('.dotfile', 'old content', 'older summary');
|
||||
update_page('.dotfile', 'some content', 'some summary');
|
||||
test_page(get_page('.dotfile'), 'some content');
|
||||
test_page(get_page('action=browse id=.dotfile revision=1'), 'old content');
|
||||
test_page(get_page('action=history id=.dotfile'), 'older summary', 'some summary');
|
||||
|
||||
@@ -1,45 +1,45 @@
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 18;
|
||||
|
||||
clear_pages();
|
||||
|
||||
update_page('Miles_Davis', 'Featuring [[John Coltrane]]'); # plain link
|
||||
update_page('John_Coltrane', '#REDIRECT Coltrane'); # no redirect
|
||||
update_page('Sonny_Stitt', '#REDIRECT [[Stitt]]'); # redirect
|
||||
update_page('Keith_Jarret', 'Plays with [[Gary Peacock]]'); # link to perm. anchor
|
||||
update_page('Jack_DeJohnette', 'A friend of [::Gary Peacock]'); # define perm. anchor
|
||||
|
||||
test_page(get_page('Miles_Davis'), ('Featuring', 'John Coltrane'));
|
||||
test_page(get_page('John_Coltrane'), ('#REDIRECT Coltrane'));
|
||||
test_page(get_page('Sonny_Stitt'),
|
||||
('Status: 302', 'Location: .*wiki.pl\?action=browse;oldid=Sonny_Stitt;id=Stitt'));
|
||||
test_page(get_page('Keith_Jarret'),
|
||||
('Plays with', 'wiki.pl/Jack_DeJohnette#Gary_Peacock', 'Keith Jarret', 'Gary Peacock'));
|
||||
test_page(get_page('Gary_Peacock'),
|
||||
('Status: 302', 'Location: .*wiki.pl/Jack_DeJohnette#Gary_Peacock'));
|
||||
test_page(get_page('Jack_DeJohnette'),
|
||||
('A friend of', 'Gary Peacock', 'name="Gary_Peacock"', 'class="definition"',
|
||||
'title="Click to search for references to this permanent anchor"'));
|
||||
test_page(update_page('Jack_DeJohnette', 'A friend of Gary Peacock.'),
|
||||
'A friend of Gary Peacock.');
|
||||
test_page(get_page('Keith_Jarret'),
|
||||
('wiki.pl\?action=edit;id=Gary_Peacock'));
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 18;
|
||||
|
||||
clear_pages();
|
||||
|
||||
update_page('Miles_Davis', 'Featuring [[John Coltrane]]'); # plain link
|
||||
update_page('John_Coltrane', '#REDIRECT Coltrane'); # no redirect
|
||||
update_page('Sonny_Stitt', '#REDIRECT [[Stitt]]'); # redirect
|
||||
update_page('Keith_Jarret', 'Plays with [[Gary Peacock]]'); # link to perm. anchor
|
||||
update_page('Jack_DeJohnette', 'A friend of [::Gary Peacock]'); # define perm. anchor
|
||||
|
||||
test_page(get_page('Miles_Davis'), ('Featuring', 'John Coltrane'));
|
||||
test_page(get_page('John_Coltrane'), ('#REDIRECT Coltrane'));
|
||||
test_page(get_page('Sonny_Stitt'),
|
||||
('Status: 302', 'Location: .*wiki.pl\?action=browse;oldid=Sonny_Stitt;id=Stitt'));
|
||||
test_page(get_page('Keith_Jarret'),
|
||||
('Plays with', 'wiki.pl/Jack_DeJohnette#Gary_Peacock', 'Keith Jarret', 'Gary Peacock'));
|
||||
test_page(get_page('Gary_Peacock'),
|
||||
('Status: 302', 'Location: .*wiki.pl/Jack_DeJohnette#Gary_Peacock'));
|
||||
test_page(get_page('Jack_DeJohnette'),
|
||||
('A friend of', 'Gary Peacock', 'name="Gary_Peacock"', 'class="definition"',
|
||||
'title="Click to search for references to this permanent anchor"'));
|
||||
test_page(update_page('Jack_DeJohnette', 'A friend of Gary Peacock.'),
|
||||
'A friend of Gary Peacock.');
|
||||
test_page(get_page('Keith_Jarret'),
|
||||
('wiki.pl\?action=edit;id=Gary_Peacock'));
|
||||
|
||||
142
t/revisions.t
142
t/revisions.t
@@ -1,71 +1,71 @@
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 16;
|
||||
|
||||
clear_pages();
|
||||
|
||||
## Test revision and diff stuff
|
||||
|
||||
update_page('KeptRevisions', 'first');
|
||||
update_page('KeptRevisions', 'second');
|
||||
update_page('KeptRevisions', 'third');
|
||||
update_page('KeptRevisions', 'fourth', '', 1);
|
||||
update_page('KeptRevisions', 'fifth', '', 1);
|
||||
|
||||
# Show the current revision
|
||||
|
||||
test_page(get_page(KeptRevisions),
|
||||
'KeptRevisions',
|
||||
'fifth');
|
||||
|
||||
# Show the other revision
|
||||
|
||||
test_page(get_page('action=browse revision=2 id=KeptRevisions'),
|
||||
'Showing revision 2',
|
||||
'second');
|
||||
|
||||
test_page(get_page('action=browse revision=1 id=KeptRevisions'),
|
||||
'Showing revision 1',
|
||||
'first');
|
||||
|
||||
# Show the current revision if an inexisting revision is asked for
|
||||
|
||||
test_page(get_page('action=browse revision=9 id=KeptRevisions'),
|
||||
'Revision 9 not available \(showing current revision instead\)',
|
||||
'fifth');
|
||||
|
||||
# Disable cache and request the correct last major diff
|
||||
test_page(get_page('action=browse diff=1 id=KeptRevisions cache=0'),
|
||||
'Difference between revision 2 and revision 3',
|
||||
'second',
|
||||
'third');
|
||||
|
||||
# Show a diff from the history page comparing two specific revisions
|
||||
test_page(get_page('action=browse diff=1 revision=4 diffrevision=2 id=KeptRevisions'),
|
||||
'Difference between revision 2 and revision 4',
|
||||
'second',
|
||||
'fourth');
|
||||
|
||||
# Show no difference
|
||||
update_page('KeptRevisions', 'second');
|
||||
test_page(get_page('action=browse diff=1 revision=6 diffrevision=2 id=KeptRevisions'),
|
||||
'Difference between revision 2 and revision 6',
|
||||
'The two revisions are the same');
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 16;
|
||||
|
||||
clear_pages();
|
||||
|
||||
## Test revision and diff stuff
|
||||
|
||||
update_page('KeptRevisions', 'first');
|
||||
update_page('KeptRevisions', 'second');
|
||||
update_page('KeptRevisions', 'third');
|
||||
update_page('KeptRevisions', 'fourth', '', 1);
|
||||
update_page('KeptRevisions', 'fifth', '', 1);
|
||||
|
||||
# Show the current revision
|
||||
|
||||
test_page(get_page(KeptRevisions),
|
||||
'KeptRevisions',
|
||||
'fifth');
|
||||
|
||||
# Show the other revision
|
||||
|
||||
test_page(get_page('action=browse revision=2 id=KeptRevisions'),
|
||||
'Showing revision 2',
|
||||
'second');
|
||||
|
||||
test_page(get_page('action=browse revision=1 id=KeptRevisions'),
|
||||
'Showing revision 1',
|
||||
'first');
|
||||
|
||||
# Show the current revision if an inexisting revision is asked for
|
||||
|
||||
test_page(get_page('action=browse revision=9 id=KeptRevisions'),
|
||||
'Revision 9 not available \(showing current revision instead\)',
|
||||
'fifth');
|
||||
|
||||
# Disable cache and request the correct last major diff
|
||||
test_page(get_page('action=browse diff=1 id=KeptRevisions cache=0'),
|
||||
'Difference between revision 2 and revision 3',
|
||||
'second',
|
||||
'third');
|
||||
|
||||
# Show a diff from the history page comparing two specific revisions
|
||||
test_page(get_page('action=browse diff=1 revision=4 diffrevision=2 id=KeptRevisions'),
|
||||
'Difference between revision 2 and revision 4',
|
||||
'second',
|
||||
'fourth');
|
||||
|
||||
# Show no difference
|
||||
update_page('KeptRevisions', 'second');
|
||||
test_page(get_page('action=browse diff=1 revision=6 diffrevision=2 id=KeptRevisions'),
|
||||
'Difference between revision 2 and revision 6',
|
||||
'The two revisions are the same');
|
||||
|
||||
232
t/rollback.t
232
t/rollback.t
@@ -1,116 +1,116 @@
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 33;
|
||||
|
||||
clear_pages();
|
||||
|
||||
# old revisions
|
||||
update_page('InnocentPage', 'Innocent.', 'good guy zero');
|
||||
update_page('NicePage', 'Friendly content.', 'good guy one');
|
||||
update_page('OtherPage', 'Other cute content 1.', 'another good guy');
|
||||
update_page('OtherPage', 'Other cute content 2.', 'another good guy');
|
||||
update_page('OtherPage', 'Other cute content 3.', 'another good guy');
|
||||
update_page('OtherPage', 'Other cute content 4.', 'another good guy');
|
||||
update_page('OtherPage', 'Other cute content 5.', 'another good guy');
|
||||
update_page('OtherPage', 'Other cute content 6.', 'another good guy');
|
||||
update_page('OtherPage', 'Other cute content 7.', 'another good guy');
|
||||
update_page('OtherPage', 'Other cute content 8.', 'another good guy');
|
||||
update_page('OtherPage', 'Other cute content 9.', 'another good guy');
|
||||
update_page('OtherPage', 'Other cute content 10.', 'another good guy');
|
||||
update_page('OtherPage', 'Other cute content 11.', 'another good guy');
|
||||
|
||||
# good revisions -- need a different timestamp than the old revisions!
|
||||
sleep(1);
|
||||
update_page('InnocentPage', 'Lamb.', 'good guy zero');
|
||||
update_page('OtherPage', 'Other cute content 12.', 'another good guy');
|
||||
update_page('MinorPage', 'Dumdidu', 'tester');
|
||||
|
||||
# last good revision -- needs a different timestamp than the good revisions!
|
||||
sleep(1);
|
||||
update_page('NicePage', 'Nice content.', 'good guy two');
|
||||
|
||||
# bad revisions -- need a different timestamp than the last good revision!
|
||||
sleep(1);
|
||||
|
||||
update_page('NicePage', 'Evil content.', 'vandal one');
|
||||
update_page('OtherPage', 'Other evil content.', 'another vandal');
|
||||
update_page('NicePage', 'Bad content.', 'vandal two');
|
||||
update_page('EvilPage', 'Spam!', 'vandal three');
|
||||
update_page('AnotherEvilPage', 'More Spam!', 'vandal four');
|
||||
update_page('AnotherEvilPage', 'Still More Spam!', 'vandal five');
|
||||
update_page('MinorPage', 'Ramtatam', 'testerror', 1);
|
||||
|
||||
test_page(get_page('NicePage'), 'Bad content');
|
||||
test_page(get_page('InnocentPage'), 'Lamb');
|
||||
|
||||
$to = xpath_test(get_page('action=rc all=1 pwd=foo'),
|
||||
'//strong[text()="good guy two"]/preceding-sibling::a[@class="rollback"]/attribute::href');
|
||||
$to =~ /action=rollback;to=([0-9]+)/;
|
||||
$to = $1;
|
||||
|
||||
test_page(get_page("action=rollback to=$to"), 'username is required');
|
||||
test_page(get_page("action=rollback to=$to username=me"), 'restricted to administrators');
|
||||
test_page(get_page("action=rollback to=$to pwd=foo"),
|
||||
'Rolling back changes',
|
||||
'EvilPage</a> rolled back',
|
||||
'AnotherEvilPage</a> rolled back',
|
||||
'MinorPage</a> rolled back',
|
||||
'NicePage</a> rolled back',
|
||||
'OtherPage</a> rolled back');
|
||||
|
||||
test_page(get_page('NicePage'), 'Nice content');
|
||||
test_page(get_page('OtherPage'), 'Other cute content 12');
|
||||
test_page(get_page('EvilPage'), 'DeletedPage');
|
||||
test_page(get_page('AnotherEvilPage'), 'DeletedPage');
|
||||
test_page(get_page('InnocentPage'), 'Lamb');
|
||||
|
||||
my $rc = get_page('action=rc all=1 showedit=1 pwd=foo'); # this includes rollback info and rollback links
|
||||
|
||||
# check all revisions of NicePage in recent changes
|
||||
xpath_test($rc,
|
||||
'//li/span[@class="time"]/following-sibling::span[@class="new"][text()="new"]/following-sibling::a[@class="rollback"][text()="rollback"]/following-sibling::a[@class="revision"][@href="http://localhost/wiki.pl?action=browse;id=NicePage;revision=1"][text()="NicePage"]/following-sibling::span[@class="dash"]/following-sibling::strong[text()="good guy one"]',
|
||||
'//li/span[@class="time"]/following-sibling::a[@class="diff"][@href="http://localhost/wiki.pl?action=browse;diff=2;id=NicePage;diffrevision=2"][text()="diff"]/following-sibling::a[@class="rollback"][text()="rollback"]/following-sibling::a[@class="revision"][@href="http://localhost/wiki.pl?action=browse;id=NicePage;revision=2"][text()="NicePage"]/following-sibling::span[@class="dash"]/following-sibling::strong[text()="good guy two"]',
|
||||
'//li/span[@class="time"]/following-sibling::a[@class="diff"][@href="http://localhost/wiki.pl?action=browse;diff=2;id=NicePage;diffrevision=3"][text()="diff"]/following-sibling::a[@class="rollback"][text()="rollback"]/following-sibling::a[@class="revision"][@href="http://localhost/wiki.pl?action=browse;id=NicePage;revision=3"][text()="NicePage"]/following-sibling::span[@class="dash"]/following-sibling::strong[text()="vandal one"]',
|
||||
'//li/span[@class="time"]/following-sibling::a[@class="diff"][@href="http://localhost/wiki.pl?action=browse;diff=2;id=NicePage;diffrevision=4"][text()="diff"]/following-sibling::a[@class="rollback"]/following-sibling::a[@class="revision"][@href="http://localhost/wiki.pl?action=browse;id=NicePage;revision=4"][text()="NicePage"]/following-sibling::span[@class="dash"]/following-sibling::strong[text()="vandal two"]',
|
||||
'//li/span[@class="time"]/following-sibling::a[@class="diff"][@href="http://localhost/wiki.pl?action=browse;diff=2;id=NicePage"][text()="diff"]/following-sibling::a[@class="rollback"][text()="rollback"]/following-sibling::a[@class="revision"][@href="http://localhost/wiki.pl?action=browse;id=NicePage"][text()="NicePage"]/following-sibling::span[@class="dash"]/following-sibling::strong[contains(text(),"Rollback to")]',
|
||||
# check that the minor spam is reverted with a minor rollback
|
||||
'//li/span[@class="time"]/following-sibling::span[@class="new"][text()="new"]/following-sibling::a[@class="rollback"][text()="rollback"]/following-sibling::a[@class="revision"][@href="http://localhost/wiki.pl?action=browse;id=MinorPage;revision=1"][text()="MinorPage"]/following-sibling::span[@class="dash"]/following-sibling::strong[text()="tester"]',
|
||||
'//li/span[@class="time"]/following-sibling::a[@class="diff"][@href="http://localhost/wiki.pl?action=browse;diff=2;id=MinorPage;diffrevision=2"][text()="diff"]/following-sibling::a[@class="rollback"][text()="rollback"]/following-sibling::a[@class="revision"][@href="http://localhost/wiki.pl?action=browse;id=MinorPage;revision=2"][text()="MinorPage"]/following-sibling::span[@class="dash"]/following-sibling::strong[text()="testerror"]/following-sibling::em[text()="(minor)"]',
|
||||
'//li/span[@class="time"]/following-sibling::a[@class="diff"][@href="http://localhost/wiki.pl?action=browse;diff=2;id=MinorPage"][text()="diff"]/following-sibling::a[@class="rollback"][text()="rollback"]/following-sibling::a[@class="revision"][@href="http://localhost/wiki.pl?action=browse;id=MinorPage"][text()="MinorPage"]/following-sibling::span[@class="dash"]/following-sibling::strong[contains(text(),"Rollback to")]/following-sibling::em[text()="(minor)"]',
|
||||
);
|
||||
|
||||
# test that ordinary RC doesn't show the rollback stuff
|
||||
update_page('Yoga', 'Ommmm', 'peace');
|
||||
|
||||
$page = get_page('action=rc raw=1');
|
||||
test_page($page,
|
||||
"title: NicePage\ndescription: good guy two\n",
|
||||
"title: MinorPage\ndescription: tester\n",
|
||||
"title: OtherPage\ndescription: another good guy\n",
|
||||
"title: InnocentPage\ndescription: good guy zero\n",
|
||||
"title: Yoga\ndescription: peace\n",
|
||||
);
|
||||
test_page_negative($page,
|
||||
"rollback",
|
||||
"Rollback",
|
||||
"EvilPage",
|
||||
"AnotherEvilPage",
|
||||
);
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 33;
|
||||
|
||||
clear_pages();
|
||||
|
||||
# old revisions
|
||||
update_page('InnocentPage', 'Innocent.', 'good guy zero');
|
||||
update_page('NicePage', 'Friendly content.', 'good guy one');
|
||||
update_page('OtherPage', 'Other cute content 1.', 'another good guy');
|
||||
update_page('OtherPage', 'Other cute content 2.', 'another good guy');
|
||||
update_page('OtherPage', 'Other cute content 3.', 'another good guy');
|
||||
update_page('OtherPage', 'Other cute content 4.', 'another good guy');
|
||||
update_page('OtherPage', 'Other cute content 5.', 'another good guy');
|
||||
update_page('OtherPage', 'Other cute content 6.', 'another good guy');
|
||||
update_page('OtherPage', 'Other cute content 7.', 'another good guy');
|
||||
update_page('OtherPage', 'Other cute content 8.', 'another good guy');
|
||||
update_page('OtherPage', 'Other cute content 9.', 'another good guy');
|
||||
update_page('OtherPage', 'Other cute content 10.', 'another good guy');
|
||||
update_page('OtherPage', 'Other cute content 11.', 'another good guy');
|
||||
|
||||
# good revisions -- need a different timestamp than the old revisions!
|
||||
sleep(1);
|
||||
update_page('InnocentPage', 'Lamb.', 'good guy zero');
|
||||
update_page('OtherPage', 'Other cute content 12.', 'another good guy');
|
||||
update_page('MinorPage', 'Dumdidu', 'tester');
|
||||
|
||||
# last good revision -- needs a different timestamp than the good revisions!
|
||||
sleep(1);
|
||||
update_page('NicePage', 'Nice content.', 'good guy two');
|
||||
|
||||
# bad revisions -- need a different timestamp than the last good revision!
|
||||
sleep(1);
|
||||
|
||||
update_page('NicePage', 'Evil content.', 'vandal one');
|
||||
update_page('OtherPage', 'Other evil content.', 'another vandal');
|
||||
update_page('NicePage', 'Bad content.', 'vandal two');
|
||||
update_page('EvilPage', 'Spam!', 'vandal three');
|
||||
update_page('AnotherEvilPage', 'More Spam!', 'vandal four');
|
||||
update_page('AnotherEvilPage', 'Still More Spam!', 'vandal five');
|
||||
update_page('MinorPage', 'Ramtatam', 'testerror', 1);
|
||||
|
||||
test_page(get_page('NicePage'), 'Bad content');
|
||||
test_page(get_page('InnocentPage'), 'Lamb');
|
||||
|
||||
$to = xpath_test(get_page('action=rc all=1 pwd=foo'),
|
||||
'//strong[text()="good guy two"]/preceding-sibling::a[@class="rollback"]/attribute::href');
|
||||
$to =~ /action=rollback;to=([0-9]+)/;
|
||||
$to = $1;
|
||||
|
||||
test_page(get_page("action=rollback to=$to"), 'username is required');
|
||||
test_page(get_page("action=rollback to=$to username=me"), 'restricted to administrators');
|
||||
test_page(get_page("action=rollback to=$to pwd=foo"),
|
||||
'Rolling back changes',
|
||||
'EvilPage</a> rolled back',
|
||||
'AnotherEvilPage</a> rolled back',
|
||||
'MinorPage</a> rolled back',
|
||||
'NicePage</a> rolled back',
|
||||
'OtherPage</a> rolled back');
|
||||
|
||||
test_page(get_page('NicePage'), 'Nice content');
|
||||
test_page(get_page('OtherPage'), 'Other cute content 12');
|
||||
test_page(get_page('EvilPage'), 'DeletedPage');
|
||||
test_page(get_page('AnotherEvilPage'), 'DeletedPage');
|
||||
test_page(get_page('InnocentPage'), 'Lamb');
|
||||
|
||||
my $rc = get_page('action=rc all=1 showedit=1 pwd=foo'); # this includes rollback info and rollback links
|
||||
|
||||
# check all revisions of NicePage in recent changes
|
||||
xpath_test($rc,
|
||||
'//li/span[@class="time"]/following-sibling::span[@class="new"][text()="new"]/following-sibling::a[@class="rollback"][text()="rollback"]/following-sibling::a[@class="revision"][@href="http://localhost/wiki.pl?action=browse;id=NicePage;revision=1"][text()="NicePage"]/following-sibling::span[@class="dash"]/following-sibling::strong[text()="good guy one"]',
|
||||
'//li/span[@class="time"]/following-sibling::a[@class="diff"][@href="http://localhost/wiki.pl?action=browse;diff=2;id=NicePage;diffrevision=2"][text()="diff"]/following-sibling::a[@class="rollback"][text()="rollback"]/following-sibling::a[@class="revision"][@href="http://localhost/wiki.pl?action=browse;id=NicePage;revision=2"][text()="NicePage"]/following-sibling::span[@class="dash"]/following-sibling::strong[text()="good guy two"]',
|
||||
'//li/span[@class="time"]/following-sibling::a[@class="diff"][@href="http://localhost/wiki.pl?action=browse;diff=2;id=NicePage;diffrevision=3"][text()="diff"]/following-sibling::a[@class="rollback"][text()="rollback"]/following-sibling::a[@class="revision"][@href="http://localhost/wiki.pl?action=browse;id=NicePage;revision=3"][text()="NicePage"]/following-sibling::span[@class="dash"]/following-sibling::strong[text()="vandal one"]',
|
||||
'//li/span[@class="time"]/following-sibling::a[@class="diff"][@href="http://localhost/wiki.pl?action=browse;diff=2;id=NicePage;diffrevision=4"][text()="diff"]/following-sibling::a[@class="rollback"]/following-sibling::a[@class="revision"][@href="http://localhost/wiki.pl?action=browse;id=NicePage;revision=4"][text()="NicePage"]/following-sibling::span[@class="dash"]/following-sibling::strong[text()="vandal two"]',
|
||||
'//li/span[@class="time"]/following-sibling::a[@class="diff"][@href="http://localhost/wiki.pl?action=browse;diff=2;id=NicePage"][text()="diff"]/following-sibling::a[@class="rollback"][text()="rollback"]/following-sibling::a[@class="revision"][@href="http://localhost/wiki.pl?action=browse;id=NicePage"][text()="NicePage"]/following-sibling::span[@class="dash"]/following-sibling::strong[contains(text(),"Rollback to")]',
|
||||
# check that the minor spam is reverted with a minor rollback
|
||||
'//li/span[@class="time"]/following-sibling::span[@class="new"][text()="new"]/following-sibling::a[@class="rollback"][text()="rollback"]/following-sibling::a[@class="revision"][@href="http://localhost/wiki.pl?action=browse;id=MinorPage;revision=1"][text()="MinorPage"]/following-sibling::span[@class="dash"]/following-sibling::strong[text()="tester"]',
|
||||
'//li/span[@class="time"]/following-sibling::a[@class="diff"][@href="http://localhost/wiki.pl?action=browse;diff=2;id=MinorPage;diffrevision=2"][text()="diff"]/following-sibling::a[@class="rollback"][text()="rollback"]/following-sibling::a[@class="revision"][@href="http://localhost/wiki.pl?action=browse;id=MinorPage;revision=2"][text()="MinorPage"]/following-sibling::span[@class="dash"]/following-sibling::strong[text()="testerror"]/following-sibling::em[text()="(minor)"]',
|
||||
'//li/span[@class="time"]/following-sibling::a[@class="diff"][@href="http://localhost/wiki.pl?action=browse;diff=2;id=MinorPage"][text()="diff"]/following-sibling::a[@class="rollback"][text()="rollback"]/following-sibling::a[@class="revision"][@href="http://localhost/wiki.pl?action=browse;id=MinorPage"][text()="MinorPage"]/following-sibling::span[@class="dash"]/following-sibling::strong[contains(text(),"Rollback to")]/following-sibling::em[text()="(minor)"]',
|
||||
);
|
||||
|
||||
# test that ordinary RC doesn't show the rollback stuff
|
||||
update_page('Yoga', 'Ommmm', 'peace');
|
||||
|
||||
$page = get_page('action=rc raw=1');
|
||||
test_page($page,
|
||||
"title: NicePage\ndescription: good guy two\n",
|
||||
"title: MinorPage\ndescription: tester\n",
|
||||
"title: OtherPage\ndescription: another good guy\n",
|
||||
"title: InnocentPage\ndescription: good guy zero\n",
|
||||
"title: Yoga\ndescription: peace\n",
|
||||
);
|
||||
test_page_negative($page,
|
||||
"rollback",
|
||||
"Rollback",
|
||||
"EvilPage",
|
||||
"AnotherEvilPage",
|
||||
);
|
||||
|
||||
384
t/rss.t
384
t/rss.t
@@ -1,192 +1,192 @@
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 86;
|
||||
|
||||
clear_pages();
|
||||
|
||||
update_page('big', 'foofoo');
|
||||
test_page(get_page('action=rss full=1'), '<title>big: foo foo</title>');
|
||||
update_page('big', 'foo foo foo', '<mu>');
|
||||
test_page(get_page('action=rss'), '<description><mu></description>');
|
||||
test_page(get_page('action=rss full=1'), 'foo foo foo');
|
||||
test_page(get_page('action=rss full=1 diff=1'), '<div class="diff">');
|
||||
update_page('big', 'x' x 49000);
|
||||
test_page(get_page('action=rss full=1'), 'xxxxxx');
|
||||
test_page(get_page('action=rss full=1 diff=1'), 'too big to send over RSS');
|
||||
|
||||
update_page('big', 'x' x 55000, 'big edit');
|
||||
test_page_negative(get_page('action=rss full=1'), 'xxxxxx');
|
||||
test_page(get_page('action=rss full=1'), 'too big to send over RSS');
|
||||
update_page('big', "mee too\n" x 2 . 'x' x 55000);
|
||||
test_page(get_page('action=rss full=1'), 'too big to send over RSS');
|
||||
test_page(get_page('action=rss full=1 diff=1'), 'mee too', 'too big to send over RSS');
|
||||
|
||||
SKIP: {
|
||||
|
||||
eval {
|
||||
require XML::RSS;
|
||||
};
|
||||
|
||||
skip "XML::RSS not installed", 75 if $@;
|
||||
|
||||
use Cwd;
|
||||
$dir = cwd;
|
||||
$uri = "file://$dir";
|
||||
$uri =~ s/ /%20/g; # for cygdrive stuff including spaces
|
||||
|
||||
# some xpath tests
|
||||
update_page('RSS', "<rss $uri/heise.rdf>");
|
||||
$page = get_page('RSS');
|
||||
xpath_test($page, Encode::encode_utf8('//a[@title="999"][@href="http://www.heise.de/tp/deutsch/inhalt/te/15886/1.html"][text()="Berufsverbot für Mediendesigner?"]'));
|
||||
|
||||
test_page($page, split('\n',<<'EOT'));
|
||||
<div class="rss"><ul><li>
|
||||
Experimentell bestätigt:
|
||||
http://www.heise.de/tp/deutsch/inhalt/lis/15882/1.html
|
||||
Clash im Internet?
|
||||
http://www.heise.de/tp/deutsch/special/med/15787/1.html
|
||||
Die Einheit der Umma gegen die jüdische Weltmacht
|
||||
http://www.heise.de/tp/deutsch/special/ost/15879/1.html
|
||||
Im Krieg mit dem Satan
|
||||
http://www.heise.de/tp/deutsch/inhalt/co/15880/1.html
|
||||
Der dritte Mann
|
||||
http://www.heise.de/tp/deutsch/inhalt/co/15876/1.html
|
||||
Leicht neben dem Ziel
|
||||
http://www.heise.de/tp/deutsch/inhalt/mein/15867/1.html
|
||||
Wale sollten Nordkorea meiden
|
||||
http://www.heise.de/tp/deutsch/inhalt/co/15878/1.html
|
||||
Afghanistan-Krieg und Irak-Besatzung haben al-Qaida gestärkt
|
||||
http://www.heise.de/tp/deutsch/inhalt/co/15874/1.html
|
||||
Der mit dem Dinosaurier tanzt
|
||||
http://www.heise.de/tp/deutsch/inhalt/lis/15863/1.html
|
||||
Terroranschlag überschattet das Genfer Abkommen
|
||||
http://www.heise.de/tp/deutsch/special/ost/15873/1.html
|
||||
"Barwatch" in Kanada
|
||||
http://www.heise.de/tp/deutsch/inhalt/te/15871/1.html
|
||||
Die Türken kommen!
|
||||
http://www.heise.de/tp/deutsch/special/irak/15870/1.html
|
||||
Neue Regelungen zur Telekommunikationsüberwachung
|
||||
http://www.heise.de/tp/deutsch/inhalt/te/15869/1.html
|
||||
Ein Lied vom Tod
|
||||
http://www.heise.de/tp/deutsch/inhalt/kino/15862/1.html
|
||||
EOT
|
||||
|
||||
# RSS 2.0
|
||||
|
||||
update_page('RSS', "<rss $uri/flickr.xml>");
|
||||
test_page(get_page('RSS'),
|
||||
join('(.|\n)*', # verify the *order* of things.
|
||||
'href="http://www.flickr.com/photos/broccoli/867118/"',
|
||||
'href="http://www.flickr.com/photos/broccoli/867075/"',
|
||||
'href="http://www.flickr.com/photos/seuss/864332/"',
|
||||
'href="http://www.flickr.com/photos/redking/851171/"',
|
||||
'href="http://www.flickr.com/photos/redking/851168/"',
|
||||
'href="http://www.flickr.com/photos/redking/851167/"',
|
||||
'href="http://www.flickr.com/photos/redking/851166/"',
|
||||
'href="http://www.flickr.com/photos/redking/851165/"',
|
||||
'href="http://www.flickr.com/photos/bibo/844085/"',
|
||||
'href="http://www.flickr.com/photos/theunholytrinity/867312/"'),
|
||||
join('(.|\n)*',
|
||||
'title="2004-10-14 09:34:47 "',
|
||||
'title="2004-10-14 09:28:11 "',
|
||||
'title="2004-10-14 05:08:17 "',
|
||||
'title="2004-10-13 10:00:34 "',
|
||||
'title="2004-10-13 10:00:30 "',
|
||||
'title="2004-10-13 10:00:27 "',
|
||||
'title="2004-10-13 10:00:25 "',
|
||||
'title="2004-10-13 10:00:22 "',
|
||||
'title="2004-10-12 23:38:14 "',
|
||||
'title="2004-10-10 10:09:06 "'),
|
||||
join('(.|\n)*',
|
||||
'>The Hydra<',
|
||||
'>The War On Hydra<',
|
||||
'>Nation Demolished<',
|
||||
'>Drummers<',
|
||||
'>Death<',
|
||||
'>Audio Terrorists<',
|
||||
'>Crowds<',
|
||||
'>Assholes<',
|
||||
'>iraq_saddam03<',
|
||||
'>brudermann<'));
|
||||
|
||||
update_page('RSS', "<rss $uri/kensanata.xml>");
|
||||
test_page(get_page('RSS'), split('\n',<<'EOT'));
|
||||
Fania All Stars - Bamboleo
|
||||
http://www.audioscrobbler.com/music/Fania\+All\+Stars/_/Bamboleo
|
||||
EOT
|
||||
|
||||
update_page('RSS', "<rss $uri/linuxtoday.rdf>");
|
||||
test_page(get_page('RSS'), split('\n',<<'EOT'));
|
||||
PRNewswire: Texas Software Startup, Serenity Systems, Advises Business Users to Get Off Windows
|
||||
http://linuxtoday.com/story.php3\?sn=9443
|
||||
LinuxPR: MyDesktop Launches Linux Software Section
|
||||
http://linuxtoday.com/story.php3\?sn=9442
|
||||
LinuxPR: Franklin Institute Science Museum Chooses Linux
|
||||
http://linuxtoday.com/story.php3\?sn=9441
|
||||
Yellow Dog Linux releases updated am-utils
|
||||
http://linuxtoday.com/story.php3\?sn=9440
|
||||
LinuxPR: LinuxCare Adds Laser5 Linux To Roster of Supported Linux Distributions
|
||||
http://linuxtoday.com/story.php3\?sn=9439
|
||||
EOT
|
||||
|
||||
update_page('RSS', "<rss $uri/fm.rdf>");
|
||||
test_page(get_page('RSS'), split('\n',<<'EOT'));
|
||||
Xskat 3.1
|
||||
http://freshmeat.net/news/1999/09/01/936224942.html
|
||||
Java Test Driver 1.1
|
||||
http://freshmeat.net/news/1999/09/01/936224907.html
|
||||
WaveLAN/IEEE driver 1.0.1
|
||||
http://freshmeat.net/news/1999/09/01/936224545.html
|
||||
macfork 1.0
|
||||
http://freshmeat.net/news/1999/09/01/936224336.html
|
||||
QScheme 0.2.2
|
||||
http://freshmeat.net/news/1999/09/01/936223755.html
|
||||
CompuPic 4.6 build 1018
|
||||
http://freshmeat.net/news/1999/09/01/936223729.html
|
||||
eXtace 1.1.16
|
||||
http://freshmeat.net/news/1999/09/01/936223709.html
|
||||
GTC 0.3
|
||||
http://freshmeat.net/news/1999/09/01/936223686.html
|
||||
RocketJSP 0.9c
|
||||
http://freshmeat.net/news/1999/09/01/936223646.html
|
||||
Majik 3D 0.0/M3
|
||||
http://freshmeat.net/news/1999/09/01/936223622.html
|
||||
EOT
|
||||
|
||||
update_page('RSS', "<rss $uri/rss1.0.rdf>");
|
||||
test_page(get_page('RSS'), split('\n',<<'EOT'));
|
||||
GTKeyboard 0.85
|
||||
http://freshmeat.net/news/1999/06/21/930003829.html
|
||||
EOT
|
||||
|
||||
# Note, cannot identify BayleShanks as author in the mb.rdf
|
||||
update_page('RSS', "<rss $uri/mb.rdf $uri/community.rdf>");
|
||||
test_page(get_page('RSS'), split('\n',<<'EOT'));
|
||||
MeatBall:LionKimbro
|
||||
2003-10-24T22:49:33\+06:00
|
||||
CommunityWiki:RecentNearChanges
|
||||
http://www.usemod.com/cgi-bin/mb.pl\?LionKimbro
|
||||
2003-10-24T21:02:53\+00:00
|
||||
unified rc for here and meatball
|
||||
<span class="contributor"><span> \. \. \. \. </span>AlexSchroeder</span>
|
||||
http://www.emacswiki.org/cgi-bin/community\?action=browse;id=RecentNearChanges;revision=1
|
||||
EOT
|
||||
}
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 86;
|
||||
|
||||
clear_pages();
|
||||
|
||||
update_page('big', 'foofoo');
|
||||
test_page(get_page('action=rss full=1'), '<title>big: foo foo</title>');
|
||||
update_page('big', 'foo foo foo', '<mu>');
|
||||
test_page(get_page('action=rss'), '<description><mu></description>');
|
||||
test_page(get_page('action=rss full=1'), 'foo foo foo');
|
||||
test_page(get_page('action=rss full=1 diff=1'), '<div class="diff">');
|
||||
update_page('big', 'x' x 49000);
|
||||
test_page(get_page('action=rss full=1'), 'xxxxxx');
|
||||
test_page(get_page('action=rss full=1 diff=1'), 'too big to send over RSS');
|
||||
|
||||
update_page('big', 'x' x 55000, 'big edit');
|
||||
test_page_negative(get_page('action=rss full=1'), 'xxxxxx');
|
||||
test_page(get_page('action=rss full=1'), 'too big to send over RSS');
|
||||
update_page('big', "mee too\n" x 2 . 'x' x 55000);
|
||||
test_page(get_page('action=rss full=1'), 'too big to send over RSS');
|
||||
test_page(get_page('action=rss full=1 diff=1'), 'mee too', 'too big to send over RSS');
|
||||
|
||||
SKIP: {
|
||||
|
||||
eval {
|
||||
require XML::RSS;
|
||||
};
|
||||
|
||||
skip "XML::RSS not installed", 75 if $@;
|
||||
|
||||
use Cwd;
|
||||
$dir = cwd;
|
||||
$uri = "file://$dir";
|
||||
$uri =~ s/ /%20/g; # for cygdrive stuff including spaces
|
||||
|
||||
# some xpath tests
|
||||
update_page('RSS', "<rss $uri/heise.rdf>");
|
||||
$page = get_page('RSS');
|
||||
xpath_test($page, Encode::encode_utf8('//a[@title="999"][@href="http://www.heise.de/tp/deutsch/inhalt/te/15886/1.html"][text()="Berufsverbot für Mediendesigner?"]'));
|
||||
|
||||
test_page($page, split('\n',<<'EOT'));
|
||||
<div class="rss"><ul><li>
|
||||
Experimentell bestätigt:
|
||||
http://www.heise.de/tp/deutsch/inhalt/lis/15882/1.html
|
||||
Clash im Internet?
|
||||
http://www.heise.de/tp/deutsch/special/med/15787/1.html
|
||||
Die Einheit der Umma gegen die jüdische Weltmacht
|
||||
http://www.heise.de/tp/deutsch/special/ost/15879/1.html
|
||||
Im Krieg mit dem Satan
|
||||
http://www.heise.de/tp/deutsch/inhalt/co/15880/1.html
|
||||
Der dritte Mann
|
||||
http://www.heise.de/tp/deutsch/inhalt/co/15876/1.html
|
||||
Leicht neben dem Ziel
|
||||
http://www.heise.de/tp/deutsch/inhalt/mein/15867/1.html
|
||||
Wale sollten Nordkorea meiden
|
||||
http://www.heise.de/tp/deutsch/inhalt/co/15878/1.html
|
||||
Afghanistan-Krieg und Irak-Besatzung haben al-Qaida gestärkt
|
||||
http://www.heise.de/tp/deutsch/inhalt/co/15874/1.html
|
||||
Der mit dem Dinosaurier tanzt
|
||||
http://www.heise.de/tp/deutsch/inhalt/lis/15863/1.html
|
||||
Terroranschlag überschattet das Genfer Abkommen
|
||||
http://www.heise.de/tp/deutsch/special/ost/15873/1.html
|
||||
"Barwatch" in Kanada
|
||||
http://www.heise.de/tp/deutsch/inhalt/te/15871/1.html
|
||||
Die Türken kommen!
|
||||
http://www.heise.de/tp/deutsch/special/irak/15870/1.html
|
||||
Neue Regelungen zur Telekommunikationsüberwachung
|
||||
http://www.heise.de/tp/deutsch/inhalt/te/15869/1.html
|
||||
Ein Lied vom Tod
|
||||
http://www.heise.de/tp/deutsch/inhalt/kino/15862/1.html
|
||||
EOT
|
||||
|
||||
# RSS 2.0
|
||||
|
||||
update_page('RSS', "<rss $uri/flickr.xml>");
|
||||
test_page(get_page('RSS'),
|
||||
join('(.|\n)*', # verify the *order* of things.
|
||||
'href="http://www.flickr.com/photos/broccoli/867118/"',
|
||||
'href="http://www.flickr.com/photos/broccoli/867075/"',
|
||||
'href="http://www.flickr.com/photos/seuss/864332/"',
|
||||
'href="http://www.flickr.com/photos/redking/851171/"',
|
||||
'href="http://www.flickr.com/photos/redking/851168/"',
|
||||
'href="http://www.flickr.com/photos/redking/851167/"',
|
||||
'href="http://www.flickr.com/photos/redking/851166/"',
|
||||
'href="http://www.flickr.com/photos/redking/851165/"',
|
||||
'href="http://www.flickr.com/photos/bibo/844085/"',
|
||||
'href="http://www.flickr.com/photos/theunholytrinity/867312/"'),
|
||||
join('(.|\n)*',
|
||||
'title="2004-10-14 09:34:47 "',
|
||||
'title="2004-10-14 09:28:11 "',
|
||||
'title="2004-10-14 05:08:17 "',
|
||||
'title="2004-10-13 10:00:34 "',
|
||||
'title="2004-10-13 10:00:30 "',
|
||||
'title="2004-10-13 10:00:27 "',
|
||||
'title="2004-10-13 10:00:25 "',
|
||||
'title="2004-10-13 10:00:22 "',
|
||||
'title="2004-10-12 23:38:14 "',
|
||||
'title="2004-10-10 10:09:06 "'),
|
||||
join('(.|\n)*',
|
||||
'>The Hydra<',
|
||||
'>The War On Hydra<',
|
||||
'>Nation Demolished<',
|
||||
'>Drummers<',
|
||||
'>Death<',
|
||||
'>Audio Terrorists<',
|
||||
'>Crowds<',
|
||||
'>Assholes<',
|
||||
'>iraq_saddam03<',
|
||||
'>brudermann<'));
|
||||
|
||||
update_page('RSS', "<rss $uri/kensanata.xml>");
|
||||
test_page(get_page('RSS'), split('\n',<<'EOT'));
|
||||
Fania All Stars - Bamboleo
|
||||
http://www.audioscrobbler.com/music/Fania\+All\+Stars/_/Bamboleo
|
||||
EOT
|
||||
|
||||
update_page('RSS', "<rss $uri/linuxtoday.rdf>");
|
||||
test_page(get_page('RSS'), split('\n',<<'EOT'));
|
||||
PRNewswire: Texas Software Startup, Serenity Systems, Advises Business Users to Get Off Windows
|
||||
http://linuxtoday.com/story.php3\?sn=9443
|
||||
LinuxPR: MyDesktop Launches Linux Software Section
|
||||
http://linuxtoday.com/story.php3\?sn=9442
|
||||
LinuxPR: Franklin Institute Science Museum Chooses Linux
|
||||
http://linuxtoday.com/story.php3\?sn=9441
|
||||
Yellow Dog Linux releases updated am-utils
|
||||
http://linuxtoday.com/story.php3\?sn=9440
|
||||
LinuxPR: LinuxCare Adds Laser5 Linux To Roster of Supported Linux Distributions
|
||||
http://linuxtoday.com/story.php3\?sn=9439
|
||||
EOT
|
||||
|
||||
update_page('RSS', "<rss $uri/fm.rdf>");
|
||||
test_page(get_page('RSS'), split('\n',<<'EOT'));
|
||||
Xskat 3.1
|
||||
http://freshmeat.net/news/1999/09/01/936224942.html
|
||||
Java Test Driver 1.1
|
||||
http://freshmeat.net/news/1999/09/01/936224907.html
|
||||
WaveLAN/IEEE driver 1.0.1
|
||||
http://freshmeat.net/news/1999/09/01/936224545.html
|
||||
macfork 1.0
|
||||
http://freshmeat.net/news/1999/09/01/936224336.html
|
||||
QScheme 0.2.2
|
||||
http://freshmeat.net/news/1999/09/01/936223755.html
|
||||
CompuPic 4.6 build 1018
|
||||
http://freshmeat.net/news/1999/09/01/936223729.html
|
||||
eXtace 1.1.16
|
||||
http://freshmeat.net/news/1999/09/01/936223709.html
|
||||
GTC 0.3
|
||||
http://freshmeat.net/news/1999/09/01/936223686.html
|
||||
RocketJSP 0.9c
|
||||
http://freshmeat.net/news/1999/09/01/936223646.html
|
||||
Majik 3D 0.0/M3
|
||||
http://freshmeat.net/news/1999/09/01/936223622.html
|
||||
EOT
|
||||
|
||||
update_page('RSS', "<rss $uri/rss1.0.rdf>");
|
||||
test_page(get_page('RSS'), split('\n',<<'EOT'));
|
||||
GTKeyboard 0.85
|
||||
http://freshmeat.net/news/1999/06/21/930003829.html
|
||||
EOT
|
||||
|
||||
# Note, cannot identify BayleShanks as author in the mb.rdf
|
||||
update_page('RSS', "<rss $uri/mb.rdf $uri/community.rdf>");
|
||||
test_page(get_page('RSS'), split('\n',<<'EOT'));
|
||||
MeatBall:LionKimbro
|
||||
2003-10-24T22:49:33\+06:00
|
||||
CommunityWiki:RecentNearChanges
|
||||
http://www.usemod.com/cgi-bin/mb.pl\?LionKimbro
|
||||
2003-10-24T21:02:53\+00:00
|
||||
unified rc for here and meatball
|
||||
<span class="contributor"><span> \. \. \. \. </span>AlexSchroeder</span>
|
||||
http://www.emacswiki.org/cgi-bin/community\?action=browse;id=RecentNearChanges;revision=1
|
||||
EOT
|
||||
}
|
||||
|
||||
168
t/search.t
168
t/search.t
@@ -1,84 +1,84 @@
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 23;
|
||||
|
||||
clear_pages();
|
||||
|
||||
add_module('mac.pl');
|
||||
|
||||
# Test search
|
||||
|
||||
update_page('SearchAndReplace', 'This is fooz and this is barz.', '', 1);
|
||||
$page = get_page('search=fooz');
|
||||
test_page($page,
|
||||
'<h1>Search for: fooz</h1>',
|
||||
'<p class="result">1 pages found.</p>',
|
||||
'This is <strong>fooz</strong> and this is barz.');
|
||||
xpath_test($page, '//span[@class="result"]/a[@class="local"][@href="http://localhost/wiki.pl/SearchAndReplace"][text()="SearchAndReplace"]');
|
||||
|
||||
# Brackets in the page name
|
||||
|
||||
test_page(update_page('Search (and replace)', 'Muu'),
|
||||
'search=%22Search\+%5c\(and\+replace%5c\)%22');
|
||||
|
||||
# Make sure only admins can replace
|
||||
|
||||
test_page(get_page('search=foo replace=bar'),
|
||||
'This operation is restricted to administrators only...');
|
||||
|
||||
# Simple replace where the replacement pattern is found
|
||||
|
||||
test_page(get_page('search=fooz replace=fuuz pwd=foo'), split('\n',<<'EOT'));
|
||||
<h1>Replaced: fooz -> fuuz</h1>
|
||||
<p class="result">1 pages found.</p>
|
||||
This is <strong>fuuz</strong> and this is barz.
|
||||
EOT
|
||||
|
||||
# Replace with backreferences, where the replacement pattern is no longer found
|
||||
|
||||
test_page(get_page('"search=([a-z]%2b)z" replace=x%241 pwd=foo'), '0 pages found');
|
||||
test_page(get_page('SearchAndReplace'), 'This is xfuu and this is xbar.');
|
||||
|
||||
# Create an extra page that should not be found
|
||||
update_page('NegativeSearchTest', 'this page contains an ab');
|
||||
update_page('NegativeSearchTestTwo', 'this page contains another ab');
|
||||
test_page(get_page('search=xb replace=[xa]b pwd=foo'), '1 pages found'); # not two ab!
|
||||
test_page(get_page('SearchAndReplace'), 'This is xfuu and this is \[xa\]bar.');
|
||||
|
||||
# Handle quoting
|
||||
test_page(get_page('search=xfuu replace=/fuu/ pwd=foo'), '1 pages found'); # not two ab!
|
||||
test_page(get_page('SearchAndReplace'), 'This is /fuu/ and this is \[xa\]bar.');
|
||||
test_page(get_page('search=/fuu/ replace={{fuu}} pwd=foo'), '1 pages found');
|
||||
test_page(get_page('SearchAndReplace'), 'This is {{fuu}} and this is \[xa\]bar.');
|
||||
|
||||
## Check headers especially the quoting of non-ASCII characters.
|
||||
|
||||
$page = update_page("Alexander_Schröder", "Edit [[Alexander Schröder]]!");
|
||||
xpath_test($page,
|
||||
Encode::encode_utf8('//h1/a[@title="Click to search for references to this page"][@href="http://localhost/wiki.pl?search=%22Alexander+Schr%c3%b6der%22"][text()="Alexander Schröder"]'),
|
||||
Encode::encode_utf8('//a[@class="local"][@href="http://localhost/wiki.pl/Alexander_Schr%c3%b6der"][text()="Alexander Schröder"]'));
|
||||
|
||||
xpath_test(update_page('IncludeSearch',
|
||||
"first line\n<search \"ab\">\nlast line"),
|
||||
'//p[text()="first line "]', # note the NL -> SPC
|
||||
'//div[@class="search"]/p/span[@class="result"]/a[@class="local"][@href="http://localhost/wiki.pl/NegativeSearchTest"][text()="NegativeSearchTest"]',
|
||||
'//div[@class="search"]/p/span[@class="result"]/a[@class="local"][@href="http://localhost/wiki.pl/NegativeSearchTestTwo"][text()="NegativeSearchTestTwo"]',
|
||||
'//p[text()=" last line"]'); # note the NL -> SPC
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 23;
|
||||
|
||||
clear_pages();
|
||||
|
||||
add_module('mac.pl');
|
||||
|
||||
# Test search
|
||||
|
||||
update_page('SearchAndReplace', 'This is fooz and this is barz.', '', 1);
|
||||
$page = get_page('search=fooz');
|
||||
test_page($page,
|
||||
'<h1>Search for: fooz</h1>',
|
||||
'<p class="result">1 pages found.</p>',
|
||||
'This is <strong>fooz</strong> and this is barz.');
|
||||
xpath_test($page, '//span[@class="result"]/a[@class="local"][@href="http://localhost/wiki.pl/SearchAndReplace"][text()="SearchAndReplace"]');
|
||||
|
||||
# Brackets in the page name
|
||||
|
||||
test_page(update_page('Search (and replace)', 'Muu'),
|
||||
'search=%22Search\+%5c\(and\+replace%5c\)%22');
|
||||
|
||||
# Make sure only admins can replace
|
||||
|
||||
test_page(get_page('search=foo replace=bar'),
|
||||
'This operation is restricted to administrators only...');
|
||||
|
||||
# Simple replace where the replacement pattern is found
|
||||
|
||||
test_page(get_page('search=fooz replace=fuuz pwd=foo'), split('\n',<<'EOT'));
|
||||
<h1>Replaced: fooz -> fuuz</h1>
|
||||
<p class="result">1 pages found.</p>
|
||||
This is <strong>fuuz</strong> and this is barz.
|
||||
EOT
|
||||
|
||||
# Replace with backreferences, where the replacement pattern is no longer found
|
||||
|
||||
test_page(get_page('"search=([a-z]%2b)z" replace=x%241 pwd=foo'), '0 pages found');
|
||||
test_page(get_page('SearchAndReplace'), 'This is xfuu and this is xbar.');
|
||||
|
||||
# Create an extra page that should not be found
|
||||
update_page('NegativeSearchTest', 'this page contains an ab');
|
||||
update_page('NegativeSearchTestTwo', 'this page contains another ab');
|
||||
test_page(get_page('search=xb replace=[xa]b pwd=foo'), '1 pages found'); # not two ab!
|
||||
test_page(get_page('SearchAndReplace'), 'This is xfuu and this is \[xa\]bar.');
|
||||
|
||||
# Handle quoting
|
||||
test_page(get_page('search=xfuu replace=/fuu/ pwd=foo'), '1 pages found'); # not two ab!
|
||||
test_page(get_page('SearchAndReplace'), 'This is /fuu/ and this is \[xa\]bar.');
|
||||
test_page(get_page('search=/fuu/ replace={{fuu}} pwd=foo'), '1 pages found');
|
||||
test_page(get_page('SearchAndReplace'), 'This is {{fuu}} and this is \[xa\]bar.');
|
||||
|
||||
## Check headers especially the quoting of non-ASCII characters.
|
||||
|
||||
$page = update_page("Alexander_Schröder", "Edit [[Alexander Schröder]]!");
|
||||
xpath_test($page,
|
||||
Encode::encode_utf8('//h1/a[@title="Click to search for references to this page"][@href="http://localhost/wiki.pl?search=%22Alexander+Schr%c3%b6der%22"][text()="Alexander Schröder"]'),
|
||||
Encode::encode_utf8('//a[@class="local"][@href="http://localhost/wiki.pl/Alexander_Schr%c3%b6der"][text()="Alexander Schröder"]'));
|
||||
|
||||
xpath_test(update_page('IncludeSearch',
|
||||
"first line\n<search \"ab\">\nlast line"),
|
||||
'//p[text()="first line "]', # note the NL -> SPC
|
||||
'//div[@class="search"]/p/span[@class="result"]/a[@class="local"][@href="http://localhost/wiki.pl/NegativeSearchTest"][text()="NegativeSearchTest"]',
|
||||
'//div[@class="search"]/p/span[@class="result"]/a[@class="local"][@href="http://localhost/wiki.pl/NegativeSearchTestTwo"][text()="NegativeSearchTestTwo"]',
|
||||
'//p[text()=" last line"]'); # note the NL -> SPC
|
||||
|
||||
106
t/setext.t
106
t/setext.t
@@ -1,53 +1,53 @@
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 12;
|
||||
|
||||
clear_pages();
|
||||
|
||||
do 'modules/setext.pl';
|
||||
do 'modules/link-all.pl';
|
||||
|
||||
run_tests(split('\n',<<'EOT'));
|
||||
foo
|
||||
foo
|
||||
~foo~
|
||||
<i>foo</i>
|
||||
da *foo*
|
||||
da *foo*
|
||||
da **foo** bar
|
||||
da <b>foo</b> bar
|
||||
da `_**foo**_` bar
|
||||
da **foo** bar
|
||||
_foo_
|
||||
<em style="text-decoration: underline; font-style: normal;">foo</em>
|
||||
foo_bar_baz
|
||||
foo_bar_baz
|
||||
_foo_bar_ baz
|
||||
<em style="text-decoration: underline; font-style: normal;">foo bar</em> baz
|
||||
and\nfoo\n===\n\nmore\n
|
||||
and <h2>foo</h2><p>more</p>
|
||||
and\n\nfoo\n===\n\nmore\n
|
||||
and<h2>foo</h2><p>more</p>
|
||||
and\nfoo \n--- \n\nmore\n
|
||||
and <h3>foo</h3><p>more</p>
|
||||
and\nfoo\n---\n\nmore\n
|
||||
and <h3>foo</h3><p>more</p>
|
||||
EOT
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 12;
|
||||
|
||||
clear_pages();
|
||||
|
||||
do 'modules/setext.pl';
|
||||
do 'modules/link-all.pl';
|
||||
|
||||
run_tests(split('\n',<<'EOT'));
|
||||
foo
|
||||
foo
|
||||
~foo~
|
||||
<i>foo</i>
|
||||
da *foo*
|
||||
da *foo*
|
||||
da **foo** bar
|
||||
da <b>foo</b> bar
|
||||
da `_**foo**_` bar
|
||||
da **foo** bar
|
||||
_foo_
|
||||
<em style="text-decoration: underline; font-style: normal;">foo</em>
|
||||
foo_bar_baz
|
||||
foo_bar_baz
|
||||
_foo_bar_ baz
|
||||
<em style="text-decoration: underline; font-style: normal;">foo bar</em> baz
|
||||
and\nfoo\n===\n\nmore\n
|
||||
and <h2>foo</h2><p>more</p>
|
||||
and\n\nfoo\n===\n\nmore\n
|
||||
and<h2>foo</h2><p>more</p>
|
||||
and\nfoo \n--- \n\nmore\n
|
||||
and <h3>foo</h3><p>more</p>
|
||||
and\nfoo\n---\n\nmore\n
|
||||
and <h3>foo</h3><p>more</p>
|
||||
EOT
|
||||
|
||||
@@ -1,35 +1,35 @@
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 4;
|
||||
clear_pages();
|
||||
|
||||
add_module('subscriberc.pl');
|
||||
|
||||
run_tests(split('\n',<<'EOT'));
|
||||
My subscribed pages: AlexSchroeder.
|
||||
<a href="http://localhost/test.pl?action=rc;rcfilteronly=^(AlexSchroeder)$">My subscribed pages: AlexSchroeder</a>.
|
||||
My subscribed pages: AlexSchroeder, [[LionKimbro]], [[Foo bar]].
|
||||
<a href="http://localhost/test.pl?action=rc;rcfilteronly=^(AlexSchroeder|LionKimbro|Foo_bar)$">My subscribed pages: AlexSchroeder, LionKimbro, Foo bar</a>.
|
||||
My subscribed categories: CategoryDecisionMaking, CategoryBar.
|
||||
<a href="http://localhost/test.pl?action=rc;rcfilteronly=(CategoryDecisionMaking|CategoryBar)">My subscribed categories: CategoryDecisionMaking, CategoryBar</a>.
|
||||
My subscribed pages: AlexSchroeder, [[LionKimbro]], [[Foo bar]], categories: CategoryDecisionMaking.
|
||||
<a href="http://localhost/test.pl?action=rc;rcfilteronly=^(AlexSchroeder|LionKimbro|Foo_bar)$|(CategoryDecisionMaking)">My subscribed pages: AlexSchroeder, LionKimbro, Foo bar, categories: CategoryDecisionMaking</a>.
|
||||
EOT
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 4;
|
||||
clear_pages();
|
||||
|
||||
add_module('subscriberc.pl');
|
||||
|
||||
run_tests(split('\n',<<'EOT'));
|
||||
My subscribed pages: AlexSchroeder.
|
||||
<a href="http://localhost/test.pl?action=rc;rcfilteronly=^(AlexSchroeder)$">My subscribed pages: AlexSchroeder</a>.
|
||||
My subscribed pages: AlexSchroeder, [[LionKimbro]], [[Foo bar]].
|
||||
<a href="http://localhost/test.pl?action=rc;rcfilteronly=^(AlexSchroeder|LionKimbro|Foo_bar)$">My subscribed pages: AlexSchroeder, LionKimbro, Foo bar</a>.
|
||||
My subscribed categories: CategoryDecisionMaking, CategoryBar.
|
||||
<a href="http://localhost/test.pl?action=rc;rcfilteronly=(CategoryDecisionMaking|CategoryBar)">My subscribed categories: CategoryDecisionMaking, CategoryBar</a>.
|
||||
My subscribed pages: AlexSchroeder, [[LionKimbro]], [[Foo bar]], categories: CategoryDecisionMaking.
|
||||
<a href="http://localhost/test.pl?action=rc;rcfilteronly=^(AlexSchroeder|LionKimbro|Foo_bar)$|(CategoryDecisionMaking)">My subscribed pages: AlexSchroeder, LionKimbro, Foo bar, categories: CategoryDecisionMaking</a>.
|
||||
EOT
|
||||
|
||||
70
t/summary.t
70
t/summary.t
@@ -1,35 +1,35 @@
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 4;
|
||||
|
||||
clear_pages();
|
||||
|
||||
update_page('link', 'some [http://example.com content]');
|
||||
update_page('long', q{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 2 of
|
||||
the License, or (at your option) any later version.});
|
||||
test_page(get_page('action=rc raw=1'),
|
||||
'description: some content',
|
||||
"software; you",
|
||||
"the terms",
|
||||
"Free \\. \\. \\.\n");
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 4;
|
||||
|
||||
clear_pages();
|
||||
|
||||
update_page('link', 'some [http://example.com content]');
|
||||
update_page('long', q{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 2 of
|
||||
the License, or (at your option) any later version.});
|
||||
test_page(get_page('action=rc raw=1'),
|
||||
'description: some content',
|
||||
"software; you",
|
||||
"the terms",
|
||||
"Free \\. \\. \\.\n");
|
||||
|
||||
62
t/tags.t
62
t/tags.t
@@ -1,31 +1,31 @@
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 2;
|
||||
clear_pages();
|
||||
|
||||
add_module('tags.pl');
|
||||
|
||||
xpath_run_tests(split('\n',<<'EOT'));
|
||||
[[tag:foo bar]]
|
||||
//a[@class="outside tag"][@title="Tag"][@href="http://technorati.com/tag/foo%20bar"][@rel="tag"][text()="foo bar"]
|
||||
[[tag:foo bar|mu muh!]]
|
||||
//a[@class="outside tag"][@title="Tag"][@href="http://technorati.com/tag/foo%20bar"][@rel="tag"][text()="mu muh!"]
|
||||
EOT
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 2;
|
||||
clear_pages();
|
||||
|
||||
add_module('tags.pl');
|
||||
|
||||
xpath_run_tests(split('\n',<<'EOT'));
|
||||
[[tag:foo bar]]
|
||||
//a[@class="outside tag"][@title="Tag"][@href="http://technorati.com/tag/foo%20bar"][@rel="tag"][text()="foo bar"]
|
||||
[[tag:foo bar|mu muh!]]
|
||||
//a[@class="outside tag"][@title="Tag"][@href="http://technorati.com/tag/foo%20bar"][@rel="tag"][text()="mu muh!"]
|
||||
EOT
|
||||
|
||||
@@ -60,11 +60,9 @@ sub update_page {
|
||||
$redirect = `perl wiki.pl 'Save=1' 'title=$id' 'summary=$summary' 'recent_edit=$minor' 'text=$text' 'pwd=$pwd' $rest`;
|
||||
$output = `perl wiki.pl action=browse id=$id`;
|
||||
# just in case a new page got created or NearMap or InterMap
|
||||
$IndexInit = 0;
|
||||
$NearInit = 0;
|
||||
$InterInit = 0;
|
||||
$RssInterwikiTranslateInit = 0;
|
||||
InitVariables();
|
||||
$IndexHash{$id} = 1;
|
||||
@IndexList = sort(keys %IndexHash);
|
||||
ReInit($id); # if $id eq $InterMap, we need it to be in the $IndexHash before running ReInit()
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
74
t/upload.t
74
t/upload.t
@@ -1,37 +1,37 @@
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 10;
|
||||
|
||||
clear_pages();
|
||||
|
||||
test_page(update_page('Logo', "#FILE image/png\niVBORw0KGgoAAAA"), 'Describe the new page here');
|
||||
|
||||
AppendStringToFile($ConfigFile, "\$UploadAllowed = 1;\n");
|
||||
|
||||
test_page(update_page('Logo', "#FILE image/foo\niVBORw0KGgoAAAA"), 'Describe the new page here');
|
||||
|
||||
$page = update_page('alex pic', "#FILE image/png\niVBORw0KGgoAAAA");
|
||||
test_page($page, 'This page contains an uploaded file:');
|
||||
xpath_test($page, '//img[@class="upload"][@src="http://localhost/wiki.pl/download/alex_pic"][@alt="alex pic"]');
|
||||
test_page_negative($page, 'AAAA');
|
||||
test_page_negative(get_page('search=AAA raw=1'), 'alex_pic');
|
||||
test_page(get_page('search=alex raw=1'), 'alex_pic', 'image/png');
|
||||
test_page(get_page('search=png raw=1'), 'alex_pic', 'image/png');
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
require 't/test.pl';
|
||||
package OddMuse;
|
||||
use Test::More tests => 10;
|
||||
|
||||
clear_pages();
|
||||
|
||||
test_page(update_page('Logo', "#FILE image/png\niVBORw0KGgoAAAA"), 'Describe the new page here');
|
||||
|
||||
AppendStringToFile($ConfigFile, "\$UploadAllowed = 1;\n");
|
||||
|
||||
test_page(update_page('Logo', "#FILE image/foo\niVBORw0KGgoAAAA"), 'Describe the new page here');
|
||||
|
||||
$page = update_page('alex pic', "#FILE image/png\niVBORw0KGgoAAAA");
|
||||
test_page($page, 'This page contains an uploaded file:');
|
||||
xpath_test($page, '//img[@class="upload"][@src="http://localhost/wiki.pl/download/alex_pic"][@alt="alex pic"]');
|
||||
test_page_negative($page, 'AAAA');
|
||||
test_page_negative(get_page('search=AAA raw=1'), 'alex_pic');
|
||||
test_page(get_page('search=alex raw=1'), 'alex_pic', 'image/png');
|
||||
test_page(get_page('search=png raw=1'), 'alex_pic', 'image/png');
|
||||
|
||||
@@ -1,50 +1,50 @@
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
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
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
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
|
||||
|
||||
232
t/usemod.t
232
t/usemod.t
@@ -1,116 +1,116 @@
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
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
|
||||
# Copyright (C) 2006 Alex Schroeder <alex@emacswiki.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 2 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, write to the
|
||||
# Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
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