aggregate.t 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. # Copyright (C) 2006 Alex Schroeder <alex@emacswiki.org>
  2. #
  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 3 of the License, or
  6. # (at your option) any later version.
  7. #
  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.
  12. #
  13. # You should have received a copy of the GNU General Public License
  14. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. require './t/test.pl';
  16. package OddMuse;
  17. use Test::More tests => 24;
  18. add_module('aggregate.pl');
  19. update_page('InnocentPage', 'We are innocent!');
  20. update_page('NicePage', 'You are nice.');
  21. update_page('OtherPage', 'This is off-topic.');
  22. update_page('Front_Page', q{Hello!
  23. <aggregate "NicePage" "OtherPage">
  24. The End.});
  25. $page = get_page('Front_Page');
  26. xpath_test($page, '//div[@class="content browse"]/p[text()="Hello! "]',
  27. '//div[@class="aggregate journal"]/div[@class="page"]/h2/a[@class="local"][text()="NicePage"]',
  28. '//div[@class="aggregate journal"]/div[@class="page"]/h2/a[@class="local"][text()="OtherPage"]',
  29. '//div[@class="page"]/p[text()="You are nice."]',
  30. '//div[@class="page"]/p[text()="This is off-topic."]',
  31. '//div[@class="content browse"]/p[text()=" The End."]');
  32. $page = get_page('action=aggregate id=Front_Page');
  33. test_page($page, '<title>NicePage</title>',
  34. '<title>OtherPage</title>',
  35. '<link>http://localhost/wiki.pl/NicePage</link>',
  36. '<link>http://localhost/wiki.pl/OtherPage</link>',
  37. '<description>&lt;p&gt;You are nice.&lt;/p&gt;</description>',
  38. '<description>&lt;p&gt;This is off-topic.&lt;/p&gt;</description>',
  39. '<wiki:status>new</wiki:status>',
  40. '<wiki:importance>major</wiki:importance>',
  41. quotemeta('<wiki:history>http://localhost/wiki.pl?action=history;id=NicePage</wiki:history>'),
  42. quotemeta('<wiki:diff>http://localhost/wiki.pl?action=browse;diff=1;id=NicePage</wiki:diff>'),
  43. quotemeta('<wiki:history>http://localhost/wiki.pl?action=history;id=OtherPage</wiki:history>'),
  44. quotemeta('<wiki:diff>http://localhost/wiki.pl?action=browse;diff=1;id=OtherPage</wiki:diff>'),
  45. '<title>Wiki: Front Page</title>',
  46. '<link>http://localhost/wiki.pl/Front_Page</link>',
  47. );
  48. # check for infinite loops
  49. update_page('Front_Page', q{Hello!
  50. <aggregate search off-topic>
  51. The End.});
  52. $page = get_page('Front_Page');
  53. xpath_test($page, '//div[@class="content browse"]/p[text()="Hello! "]',
  54. '//div[@class="aggregate journal"]/div[@class="page"]/h2/a[@class="local"][text()="OtherPage"]',
  55. '//div[@class="page"]/p[text()="This is off-topic."]',
  56. '//div[@class="content browse"]/p[text()=" The End."]');