1 # Copyright (C) 2006 Alex Schroeder <alex@emacswiki.org>
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the
15 # Free Software Foundation, Inc.
16 # 59 Temple Place, Suite 330
17 # Boston, MA 02111-1307 USA
21 use Test::More tests => 24;
24 add_module('aggregate.pl');
26 update_page('InnocentPage', 'We are innocent!');
27 update_page('NicePage', 'You are nice.');
28 update_page('OtherPage', 'This is off-topic.');
29 update_page('Front_Page', q{Hello!
30 <aggregate "NicePage" "OtherPage">
33 $page = get_page('Front_Page');
34 xpath_test($page, '//div[@class="content browse"]/p[text()="Hello! "]',
35 '//div[@class="aggregate journal"]/div[@class="page"]/h2/a[@class="local"][text()="NicePage"]',
36 '//div[@class="aggregate journal"]/div[@class="page"]/h2/a[@class="local"][text()="OtherPage"]',
37 '//div[@class="page"]/p[text()="You are nice."]',
38 '//div[@class="page"]/p[text()="This is off-topic."]',
39 '//div[@class="content browse"]/p[text()=" The End."]');
41 $page = get_page('action=aggregate id=Front_Page');
42 test_page($page, '<title>NicePage</title>',
43 '<title>OtherPage</title>',
44 '<link>http://localhost/wiki.pl/NicePage</link>',
45 '<link>http://localhost/wiki.pl/OtherPage</link>',
46 '<description><p>You are nice.</p></description>',
47 '<description><p>This is off-topic.</p></description>',
48 '<wiki:status>new</wiki:status>',
49 '<wiki:importance>major</wiki:importance>',
50 quotemeta('<wiki:history>http://localhost/wiki.pl?action=history;id=NicePage</wiki:history>'),
51 quotemeta('<wiki:diff>http://localhost/wiki.pl?action=browse;diff=1;id=NicePage</wiki:diff>'),
52 quotemeta('<wiki:history>http://localhost/wiki.pl?action=history;id=OtherPage</wiki:history>'),
53 quotemeta('<wiki:diff>http://localhost/wiki.pl?action=browse;diff=1;id=OtherPage</wiki:diff>'),
54 '<title>Wiki: Front Page</title>',
55 '<link>http://localhost/wiki.pl/Front_Page</link>',
58 # check for infinite loops
60 update_page('Front_Page', q{Hello!
61 <aggregate search off-topic>
64 $page = get_page('Front_Page');
65 xpath_test($page, '//div[@class="content browse"]/p[text()="Hello! "]',
66 '//div[@class="aggregate journal"]/div[@class="page"]/h2/a[@class="local"][text()="OtherPage"]',
67 '//div[@class="page"]/p[text()="This is off-topic."]',
68 '//div[@class="content browse"]/p[text()=" The End."]');