exclamation-mark.t 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. # Copyright (C) 2017 Alex Schroeder <alex@gnu.org>
  2. #
  3. # This program is free software: you can redistribute it and/or modify it under
  4. # the terms of the GNU General Public License as published by the Free Software
  5. # Foundation, either version 3 of the License, or (at your option) any later
  6. # version.
  7. #
  8. # This program is distributed in the hope that it will be useful, but WITHOUT
  9. # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  10. # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  11. #
  12. # You should have received a copy of the GNU General Public License along with
  13. # this program. If not, see <http://www.gnu.org/licenses/>.
  14. require './t/test.pl';
  15. package OddMuse;
  16. use Test::More tests => 19;
  17. use utf8; # tests contain UTF-8 characters and it matters
  18. xpath_test(update_page('Start', '[[Help!]]'),
  19. '//a[@class="edit"][@title="Click to edit this page"][@href="http://localhost/wiki.pl?action=edit;id=Help!"][text()="?"]');
  20. xpath_test(get_page('action=rc'),
  21. '//strong[text()="Help!"]');
  22. xpath_test(update_page('Help!', 'Test', 'Testing is great!'),
  23. '//h1/a[text()="Help!"]',
  24. '//div[@class="content browse"]/p[text()="Test"]');
  25. xpath_test(get_page('Start'),
  26. '//a[@class="local"][@href="http://localhost/wiki.pl/Help!"][text()="Help!"]');
  27. xpath_test(get_page('action=rc'),
  28. '//strong[text()="Testing is great!"]');
  29. xpath_test(update_page('Start', '[[image:Help!]]'),
  30. '//img[@class="upload"][@alt="Help!"][@src="http://localhost/wiki.pl/download/Help!"]');
  31. xpath_run_tests(split('\n',<<'EOT'));
  32. [http://example.org/ example!]
  33. //a[@class="url http outside"][@href="http://example.org/"][text()="example!"]
  34. EOT
  35. # Test von RSS 3.0
  36. test_page(get_page('action=rc raw=1'), 'title: Help!');
  37. add_module('creole.pl');
  38. # same test as before
  39. xpath_test(get_page('Start'),
  40. '//img[@class="upload"][@alt="Help!"][@src="http://localhost/wiki.pl/download/Help!"]');
  41. # revert and run the previous test as well
  42. xpath_test(update_page('Start', '[[Help!]]'),
  43. '//a[@class="local"][@href="http://localhost/wiki.pl/Help!"][text()="Help!"]');
  44. # Journal test
  45. update_page('2011-11-20 No Testing Today!', 'This is the page itself.');
  46. test_page(update_page('Journal', '<journal>'),
  47. '2011-11-20 No Testing Today!');
  48. # the following was copied from creole.pl
  49. update_page('InterMap', " Ohana http://www.wikiohana.org/\n", 0, 0, 1);
  50. update_page('link!', 'test');
  51. update_page('pic!', 'test');
  52. ReInit();
  53. xpath_run_tests(split('\n',<<'EOT'));
  54. [[link!]]
  55. //a[text()="link!"]
  56. [[link!|Go to my page]]
  57. //a[@class="local"][@href="http://localhost/test.pl/link!"][text()="Go to my page"]
  58. {{pic!}}
  59. //a[@class="image"][@href="http://localhost/test.pl/pic!"][img[@class="upload"][@src="http://localhost/test.pl/download/pic!"][@alt="pic!"]]
  60. [[link!|{{pic!}}]]
  61. //a[@class="image"][@href="http://localhost/test.pl/link!"][img[@class="upload"][@src="http://localhost/test.pl/download/pic!"][@alt="link!"]]
  62. [[link!|{{http://example.com/q?a=1&b=2}}]]
  63. //a[@class="image"][@href="http://localhost/test.pl/link!"][img[@class="url outside"][@src="http://example.com/q?a=1&b=2"][@alt="link!"]]
  64. [[http://example.com/q?a=1&b=2|{{pic!}}]]
  65. //a[@class="image outside"][@href="http://example.com/q?a=1&b=2"][img[@class="upload"][@src="http://localhost/test.pl/download/pic!"][@alt="http://example.com/q?a=1&b=2"]]
  66. [[link!|{{pic!|text!}}]]
  67. //a[@class="image"][@href="http://localhost/test.pl/link!"][img[@class="upload"][@src="http://localhost/test.pl/download/pic!"][@alt="text!"]]
  68. EOT