usemod.t 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. # Copyright (C) 2006–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 => 48;
  17. add_module('usemod.pl');
  18. InitVariables();
  19. run_tests(split('\n',<<'EOT'));
  20. * ''one\n** two
  21. <ul><li><em>one</em><ul><li>two</li></ul></li></ul>
  22. # one\n# two
  23. <ol><li>one</li><li>two</li></ol>
  24. * one\n# two
  25. <ul><li>one</li></ul><ol><li>two</li></ol>
  26. # one\n\n#two
  27. <ol><li>one</li></ol><p>#two</p>
  28. # one\n# two\n## one and two\n## two and three\n# three
  29. <ol><li>one</li><li>two<ol><li>one and two</li><li>two and three</li></ol></li><li>three</li></ol>
  30. # one and #\n# two and # more
  31. <ol><li>one and #</li><li>two and # more</li></ol>
  32. : one\n: two\n:: one and two\n:: two and three\n: three
  33. <dl class="quote"><dt /><dd>one</dd><dt /><dd>two<dl class="quote"><dt /><dd>one and two</dd><dt /><dd>two and three</dd></dl></dd><dt /><dd>three</dd></dl>
  34. : one and :)\n: two and :) more
  35. <dl class="quote"><dt /><dd>one and :)</dd><dt /><dd>two and :) more</dd></dl>
  36. : one\n\n:two
  37. <dl class="quote"><dt /><dd>one</dd></dl><p>:two</p>
  38. ; one:eins\n;two:zwei
  39. <dl><dt>one</dt><dd>eins ;two:zwei</dd></dl>
  40. ; one:eins\n\n; two:zwei
  41. <dl><dt>one</dt><dd>eins</dd><dt>two</dt><dd>zwei</dd></dl>
  42. ; a: b: c\n;; x: y: z
  43. <dl><dt>a</dt><dd>b: c<dl><dt>x</dt><dd>y: z</dd></dl></dd></dl>
  44. * foo <b>bold\n* bar </b>
  45. <ul><li>foo <b>bold</b></li><li>bar </li></ul>
  46. This is ''emphasized''.
  47. This is <em>emphasized</em>.
  48. This is '''strong'''.
  49. This is <strong>strong</strong>.
  50. This is ''longer emphasized'' text.
  51. This is <em>longer emphasized</em> text.
  52. This is '''longer strong''' text.
  53. This is <strong>longer strong</strong> text.
  54. This is '''''emphasized and bold''''' text.
  55. This is <strong><em>emphasized and bold</em></strong> text.
  56. This is ''emphasized '''and bold''''' text.
  57. This is <em>emphasized <strong>and bold</strong></em> text.
  58. This is '''bold ''and emphasized''''' text.
  59. This is <strong>bold <em>and emphasized</em></strong> text.
  60. This is ''emphasized text containing '''longer strong''' text''.
  61. This is <em>emphasized text containing <strong>longer strong</strong> text</em>.
  62. This is '''strong text containing ''emph'' text'''.
  63. This is <strong>strong text containing <em>emph</em> text</strong>.
  64. ||one||
  65. <table class="user"><tr class="odd first"><td>one</td></tr></table>
  66. ||one||
  67. <table class="user"><tr class="odd first"><td>one</td><td align="left"> </td></tr></table>
  68. || one ''two'' ||
  69. <table class="user"><tr class="odd first"><td align="center">one <em>two</em></td></tr></table>
  70. || one two ||
  71. <table class="user"><tr class="odd first"><td align="center">one two </td></tr></table>
  72. ||'''''foo''''' || '''''bar''''' ||\n||baz || quux ||
  73. <table class="user"><tr class="odd first"><td align="left"><strong><em>foo</em></strong></td><td align="center"><strong><em>bar</em></strong></td></tr><tr class="even"><td align="left">baz </td><td align="center">quux </td></tr></table>
  74. introduction\n\n||one||two||three||\n||||one two||three||
  75. introduction<table class="user"><tr class="odd first"><td>one</td><td>two</td><td>three</td></tr><tr class="even"><td colspan="2">one two</td><td>three</td></tr></table>
  76. ||one||two||three||\n||||one two||three||\n\nfooter
  77. <table class="user"><tr class="odd first"><td>one</td><td>two</td><td>three</td></tr><tr class="even"><td colspan="2">one two</td><td>three</td></tr></table><p>footer</p>
  78. ||one||two||three||\n||||one two||three||\n\nfooter
  79. <table class="user"><tr class="odd first"><td>one</td><td>two</td><td>three</td></tr><tr class="even"><td colspan="2">one two</td><td>three</td></tr></table><p>footer</p>
  80. || one|| two|| three||\n|||| one two|| three||\n\nfooter
  81. <table class="user"><tr class="odd first"><td align="right">one</td><td align="right">two</td><td align="right">three</td></tr><tr class="even"><td colspan="2" align="right">one two</td><td align="right">three</td></tr></table><p>footer</p>
  82. ||one ||two ||three ||\n||||one two ||three ||\n\nfooter
  83. <table class="user"><tr class="odd first"><td align="left">one </td><td align="left">two </td><td align="left">three </td></tr><tr class="even"><td colspan="2" align="left">one two </td><td align="left">three </td></tr></table><p>footer</p>
  84. || one || two || three ||\n|||| one two || three ||\n\nfooter
  85. <table class="user"><tr class="odd first"><td align="center">one </td><td align="center">two </td><td align="center">three </td></tr><tr class="even"><td colspan="2" align="center">one two </td><td align="center">three </td></tr></table><p>footer</p>
  86. introduction\n\n||one||two||three||\n||||one two||three||\n\nfooter
  87. introduction<table class="user"><tr class="odd first"><td>one</td><td>two</td><td>three</td></tr><tr class="even"><td colspan="2">one two</td><td>three</td></tr></table><p>footer</p>
  88. source
  89. <pre> source</pre>
  90. source\n etc\n
  91. <pre> source\n etc</pre>
  92. source\n \n etc\n
  93. <pre> source\n \n etc</pre>
  94. source\n \n etc\n\nother
  95. <pre> source\n \n etc</pre><p>other</p>
  96. = title =
  97. <h2>title</h2>
  98. ==title=
  99. <h2>title</h2>
  100. ========fnord=
  101. <h6>fnord</h6>
  102. == nada\nnada ==
  103. == nada nada ==
  104. == nada ==
  105. <pre> == nada ==</pre>
  106. ==[[Free Link]]==
  107. <h2>[[Free Link]]</h2>
  108. EOT
  109. $UseModMarkupInTitles = 1;
  110. run_tests(split('\n',<<'EOT'));
  111. ==n&auml;n==
  112. <h2>n&auml;n</h2>
  113. EOT
  114. # $HtmlLinks
  115. run_tests_negative(split('\n',<<'EOT'));
  116. <a href="http://www.emacswiki.org/">Emacs Wiki</a>
  117. &lt;a href="http://www.emacswiki.org/"&gt;Emacs Wiki&lt;a/a&gt;
  118. EOT
  119. $HtmlLinks = 1;
  120. run_tests(split('\n',<<'EOT'));
  121. <a href="http://www.emacswiki.org/">Emacs Wiki</a>
  122. <a href="http://www.emacswiki.org/">Emacs Wiki</a>
  123. EOT
  124. run_tests_negative(split('\n',<<'EOT'));
  125. <a onload="alert(document.cookie)" href="http://www.emacswiki.org"/>Emacs Wiki</a>
  126. <a onload="alert(document.cookie)" href="http://www.emacswiki.org"/>Emacs Wiki</a>
  127. EOT