summary.t 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. # Copyright (C) 2006, 2007 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 => 11;
  21. update_page('link', 'some [http://example.com content]');
  22. update_page('long', q{This program is >>free<< software;
  23. you can redistribute it and/or modify it under the
  24. terms of the GNU General Public License as published
  25. by the Free Software Foundation; either version 2 of
  26. the License, or (at your option) any later version.});
  27. test_page(get_page('action=rc raw=1'),
  28. 'description: some content',
  29. "software; you",
  30. "the terms",
  31. "is >>free<< software",
  32. "Public License as \\. \\. \\.\n");
  33. test_page(get_page('action=rss'),
  34. "is &amp;gt;&amp;gt;free&amp;lt;&amp;lt; software");
  35. # second edit doesn't automatically set a summary
  36. update_page('link', 'fnord');
  37. test_page_negative(get_page('action=rc raw=1'),
  38. "description: some content",
  39. "description: fnord");
  40. # explicit setting of the summary works
  41. update_page('link', 'bonk', 'bunk');
  42. test_page(get_page('action=rc raw=1'),
  43. "description: bunk");
  44. # remove links from default summary when crossing $SummaryDefaultLength
  45. update_page('size', 'lirum larum fiderallala lirum larum fiderallala lirum larum fiderallala lirum larum fiderallala lirum larum fiderallala lirum [http://example.com content]');
  46. test_page_negative(get_page('action=rc raw=1'),
  47. 'content');
  48. update_page('link', 'fnord', '[[bunk]]');
  49. test_page(get_page('action=rc raw=1'),
  50. "description: bunk");