aggregate.t 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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 2 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, write to the
  15. # Free Software Foundation, Inc.
  16. # 59 Temple Place, Suite 330
  17. # Boston, MA 02111-1307 USA
  18. require 't/test.pl';
  19. package OddMuse;
  20. use Test::More tests => 24;
  21. add_module('aggregate.pl');
  22. update_page('InnocentPage', 'We are innocent!');
  23. update_page('NicePage', 'You are nice.');
  24. update_page('OtherPage', 'This is off-topic.');
  25. update_page('Front_Page', q{Hello!
  26. <aggregate "NicePage" "OtherPage">
  27. The End.});
  28. $page = get_page('Front_Page');
  29. xpath_test($page, '//div[@class="content browse"]/p[text()="Hello! "]',
  30. '//div[@class="aggregate journal"]/div[@class="page"]/h2/a[@class="local"][text()="NicePage"]',
  31. '//div[@class="aggregate journal"]/div[@class="page"]/h2/a[@class="local"][text()="OtherPage"]',
  32. '//div[@class="page"]/p[text()="You are nice."]',
  33. '//div[@class="page"]/p[text()="This is off-topic."]',
  34. '//div[@class="content browse"]/p[text()=" The End."]');
  35. $page = get_page('action=aggregate id=Front_Page');
  36. test_page($page, '<title>NicePage</title>',
  37. '<title>OtherPage</title>',
  38. '<link>http://localhost/wiki.pl/NicePage</link>',
  39. '<link>http://localhost/wiki.pl/OtherPage</link>',
  40. '<description>&lt;p&gt;You are nice.&lt;/p&gt;</description>',
  41. '<description>&lt;p&gt;This is off-topic.&lt;/p&gt;</description>',
  42. '<wiki:status>new</wiki:status>',
  43. '<wiki:importance>major</wiki:importance>',
  44. quotemeta('<wiki:history>http://localhost/wiki.pl?action=history;id=NicePage</wiki:history>'),
  45. quotemeta('<wiki:diff>http://localhost/wiki.pl?action=browse;diff=1;id=NicePage</wiki:diff>'),
  46. quotemeta('<wiki:history>http://localhost/wiki.pl?action=history;id=OtherPage</wiki:history>'),
  47. quotemeta('<wiki:diff>http://localhost/wiki.pl?action=browse;diff=1;id=OtherPage</wiki:diff>'),
  48. '<title>Wiki: Front Page</title>',
  49. '<link>http://localhost/wiki.pl/Front_Page</link>',
  50. );
  51. # check for infinite loops
  52. update_page('Front_Page', q{Hello!
  53. <aggregate search off-topic>
  54. The End.});
  55. $page = get_page('Front_Page');
  56. xpath_test($page, '//div[@class="content browse"]/p[text()="Hello! "]',
  57. '//div[@class="aggregate journal"]/div[@class="page"]/h2/a[@class="local"][text()="OtherPage"]',
  58. '//div[@class="page"]/p[text()="This is off-topic."]',
  59. '//div[@class="content browse"]/p[text()=" The End."]');