simple-rules.t 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. # Copyright (C) 2014 Alex Schroeder <alex@gnu.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, but
  9. # WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. # 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 => 20;
  18. add_module('simple-rules.pl');
  19. update_page('foo', 'test');
  20. update_page('bar', 'test');
  21. update_page('baz', 'test');
  22. run_tests(split('\n',<<'EOT'));
  23. test
  24. <p>test</p>
  25. foo\n\nbar
  26. <p>foo</p><p>bar</p>
  27. test\n====\n
  28. <h2>test</h2>
  29. test\n----\n
  30. <h3>test</h3>
  31. foo\nbar\n\ntest\n----\n\nfoo\nbar\n
  32. <p>foo\nbar</p><h3>test</h3><p>foo\nbar</p>
  33. * foo\n* bar\n* baz\n
  34. <ul><li>foo</li><li>bar</li><li>baz</li></ul>
  35. 1. foo\n2. bar\n3. baz\n
  36. <ol><li>foo</li><li>bar</li><li>baz</li></ol>
  37. ~test~ foo
  38. <p><em>test</em> foo</p>
  39. **test foo**
  40. <p><strong>test foo</strong></p>
  41. //test foo//
  42. <p><em>test foo</em></p>
  43. __test foo__
  44. <p><u>test foo</u></p>
  45. *test* foo
  46. <p><b>test</b> foo</p>
  47. /test/ foo
  48. <p><i>test</i> foo</p>
  49. _test_ foo
  50. <p><u>test</u> foo</p>
  51. http://www.oddmuse.org/
  52. <p><a href="http://www.oddmuse.org/">http://www.oddmuse.org/</a></p>
  53. /test/ _test_ *test*
  54. <p><i>test</i> <u>test</u> <b>test</b></p>
  55. EOT
  56. xpath_run_tests(split('\n',<<'EOT'));
  57. [[foo]]
  58. //a[@class="local"][@href="http://localhost/test.pl/foo"][text()="foo"]
  59. this is [[foo]].
  60. //p/a[@class="local"][@href="http://localhost/test.pl/foo"][text()="foo"]
  61. [[foo]] and [[bar]]
  62. //a[text()="foo"]/following::a[text()="bar"]
  63. * some [[foo]]\n* [[bar]] and [[baz]]\n
  64. //ul/li[a[text()="foo"]]/following::li[a[text()="bar"]/following::a[text()="baz"]]
  65. EOT