123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- require 't/test.pl';
- package OddMuse;
- use Test::More tests => 48;
- add_module('journal-rss.pl');
- update_page('2008-09-21', 'first page');
- update_page('2008-09-22', 'second page');
- sleep(1);
- update_page('2008-09-22', 'third edit', 'third edit', 1);
- update_page('unrelated', 'wrong page');
- my $page = get_page('action=journal');
- test_page($page,
- '2008-09-21', 'first page',
-
-
- '2008-09-22', 'second page',
-
- '2008-09-22(.*\n)+.*2008-09-21');
- test_page_negative($page, 'unrelated', 'wrong page',
- 'third edit');
- test_page(get_page('action=journal'),
- '2008-09-22(.*\n)+.*2008-09-21');
- test_page(get_page('action=journal reverse=1'),
- '2008-09-21(.*\n)+.*2008-09-22');
- $page = get_page('action=journal match=21');
- test_page($page, '2008-09-21', 'first page');
- test_page_negative($page, '2008-09-22', 'second page');
- $page = get_page('action=journal search=second');
- test_page_negative($page,
- '2008-09-21', 'first page',
- '2008-09-22', 'second page',
- 'third edit');
- $page = get_page('action=journal search=third');
- test_page($page, '2008-09-22', 'second page');
- test_page_negative($page, '2008-09-21', 'first page', 'third edit');
- update_page('2008-09-05', 'page');
- update_page('2008-09-06', 'page');
- update_page('2008-09-07', 'page');
- update_page('2008-09-08', 'page');
- update_page('2008-09-09', 'page');
- update_page('2008-09-10', 'page');
- update_page('2008-09-11', 'page');
- update_page('2008-09-12', 'page');
- update_page('2008-09-13', 'page');
- update_page('2008-09-14', 'page');
- update_page('2008-09-15', 'page');
- update_page('2008-09-16', 'page');
- update_page('2008-09-17', 'page');
- update_page('2008-09-18', 'page');
- update_page('2008-09-19', 'page');
- update_page('2008-09-20', 'page');
- $page = get_page('action=journal');
- test_page($page, '2008-09-22', '2008-09-21', '2008-09-20', '2008-09-19',
- '2008-09-18', '2008-09-17', '2008-09-16', '2008-09-15',
- '2008-09-14', '2008-09-13');
- test_page_negative($page, '2008-09-12', '2008-09-11', '2008-09-10',
- '2008-09-09', '2008-09-08', '2008-09-07',
- '2008-09-06', '2008-09-05');
- $page = get_page('action=journal rsslimit=1');
- test_page($page, '2008-09-22');
- test_page_negative($page, '2008-09-21');
- $page = get_page('action=journal rsslimit=all');
- test_page($page, '2008-09-22', '2008-09-05');
- my @dates = get_page('action=rss showedit=1 all=1 match=2008-09-22')
- =~ m!<pubDate>(.*?)</pubDate>!g;
- my $date2 = $dates[1];
- my $date1 = $dates[2];
- my ($item) = $page =~ m!(<item>\n<title>2008-09-22</title>\n(.*\n)+?</item>\n)!;
- test_page($item, "<pubDate>$date1</pubDate>");
- test_page_negative($item, "<pubDate>$date2</pubDate>");
|