markdown-rule.t 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. #!/usr/bin/env perl
  2. # Copyright (C) 2014 Alex Schroeder <alex@gnu.org>
  3. #
  4. # This program is free software; you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation; either version 3 of the License, or
  7. # (at your option) any later version.
  8. #
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU General Public License
  15. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. require 't/test.pl';
  17. package OddMuse;
  18. use Test::More tests => 34;
  19. add_module('markdown-rule.pl');
  20. # ApplyRules strips trailing newlines, so write tests accordingly.
  21. run_tests(split(/\n/,<<'EOT'));
  22. 1. one
  23. <ol><li>one</li></ol>
  24. 2. one
  25. 2. one
  26. 1. one\n2. two
  27. <ol><li>one</li><li>two</li></ol>
  28. 1. one\n\n2. two
  29. <ol><li>one</li><li>two</li></ol>
  30. - one
  31. <ul><li>one</li></ul>
  32. - one\n-- Alex
  33. <ul><li>one</li><li>- Alex</li></ul>
  34. - one\n\n- Alex
  35. <ul><li>one</li><li>Alex</li></ul>
  36. this is ***bold italic*** yo!
  37. this is <em><strong>bold italic</strong></em> yo!
  38. this is **bold**
  39. this is <strong>bold</strong>
  40. **bold**
  41. <strong>bold</strong>
  42. *italic*
  43. <em>italic</em>
  44. foo\nbar
  45. foo bar
  46. foo\n===\nbar
  47. <h2>foo</h2><p>bar</p>
  48. foo\n---\nbar
  49. <h3>foo</h3><p>bar</p>
  50. foo\n=== bar
  51. foo === bar
  52. foo\n=\nbar
  53. <h2>foo</h2><p>bar</p>
  54. # foo
  55. <h1>foo</h1>
  56. ## foo
  57. <h2>foo</h2>
  58. ### foo
  59. <h3>foo</h3>
  60. #### foo
  61. <h4>foo</h4>
  62. ##### foo
  63. <h5>foo</h5>
  64. ###### foo
  65. <h6>foo</h6>
  66. ####### foo
  67. <h6># foo</h6>
  68. ## foo ##
  69. <h2>foo ##</h2>
  70. bar\n##foo\nbar
  71. bar <h2>foo</h2><p>bar</p>
  72. ```\nfoo\n```\nbar
  73. <pre>foo</pre><p>bar</p>
  74. ```\nfoo\n```
  75. <pre>foo</pre>
  76. ```\nfoo\n``` bar
  77. ``` foo ``` bar
  78. |a|b|\n|c|d|\nbar
  79. <table><tr><th>a</th><th>b</th></tr><tr><td>c</td><td>d</td></tr></table><p>bar</p>
  80. |a|b|\n|c|d|
  81. <table><tr><th>a</th><th>b</th></tr><tr><td>c</td><td>d</td></tr></table>
  82. |a
  83. <table><tr><th>a</th></tr></table>
  84. foo ~~bar~~
  85. foo <del>bar</del>
  86. EOT
  87. xpath_run_tests(split('\n',<<'EOT'));
  88. [an example](http://example.com/ "Title")
  89. //a[@class="url http"][@href="http://example.com/"][@title="Title"][text()="an example"]
  90. [an example](http://example.com/)
  91. //a[@class="url http"][@href="http://example.com/"][text()="an example"]
  92. EOT