Files
oddmuse/t/journal3.t
Aleks-Daniel Jakimenko c4671a8909 Removing clear_pages() from the beginning of tests (part 1)
This script was used:
perl -0pi -e 's/(use Test[^\n]+)\n+clear_pages\(\);[^\n]*\n+/$1\n\n/' *.t
2015-07-05 03:28:46 +03:00

70 lines
2.7 KiB
Perl
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Copyright (C) 20112014 Alex Schroeder <alex@gnu.org>
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/>.
require 't/test.pl';
package OddMuse;
use Test::More tests => 35;
update_page('2011-12-17', "today");
update_page('2011-12-16', "yesterday");
update_page('2011-12-15', "before yesterday");
update_page('2011-12-14', "this Wednesday");
update_page('2011-12-13', "this Tuesday");
update_page('2011-12-12', "this Monday");
update_page('2011-12-11', "last Sunday");
update_page('2011-12-10', "last Saturday");
update_page('2011-12-09', "last Friday");
update_page('2011-12-08', "Thursday a week ago");
# check that the limit is taken into account
$page = update_page('Summary', "This is my journal:\n\n<journal 5>");
test_page($page, '2011-12-17', '2011-12-16', '2011-12-15',
'2011-12-14', '2011-12-13');
test_page_negative($page, '2011-12-12', '2011-12-11', '2011-12-10',
'2011-12-09', '2011-12-08');
xpath_test($page, '//a[@href="http://localhost/wiki.pl?action=more;num=5;regexp=%5e%5cd%5cd%5cd%5cd-%5cd%5cd-%5cd%5cd;search=;mode=;offset=5;variation=journal"][text()="More..."]');
# check that the link for more actually works
$page = get_page("action=more num=5 offset=5 ");
test_page_negative($page, '2011-12-17', '2011-12-16', '2011-12-15',
'2011-12-14', '2011-12-13');
test_page($page, '2011-12-12', '2011-12-11', '2011-12-10',
'2011-12-09', '2011-12-08');
xpath_test_negative($page, '//a[text()="More..."]');
# check that the link for more appears correctly
$page = get_page("action=more num=5 offset=4 ");
test_page_negative($page, '2011-12-17', '2011-12-16', '2011-12-15',
'2011-12-14', '2011-12-08');
test_page($page, '2011-12-13', '2011-12-12', '2011-12-11',
'2011-12-10', '2011-12-09');
xpath_test($page, '//a[text()="More..."]');
# one last check
xpath_test_negative(get_page("action=more num=5 offset=6 "),
'//a[text()="More..."]');
# check for unescaped URL
$page = update_page('Plus', "Using a plus:\n\n<journal 5 \"^.+\">");
xpath_test($page, '//a[text()="More..."][@href="http://localhost/wiki.pl?action=more;num=5;regexp=%5e.%2b;search=;mode=;offset=5;variation=journal"]');