usemod.t 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. # Copyright (C) 2006–2015 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 => 47;
  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. introduction\n\n||one||two||three||\n||||one two||three||
  73. 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>
  74. ||one||two||three||\n||||one two||three||\n\nfooter
  75. <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>
  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 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>
  80. ||one ||two ||three ||\n||||one two ||three ||\n\nfooter
  81. <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>
  82. || one || two || three ||\n|||| one two || three ||\n\nfooter
  83. <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>
  84. introduction\n\n||one||two||three||\n||||one two||three||\n\nfooter
  85. 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>
  86. source
  87. <pre> source</pre>
  88. source\n etc\n
  89. <pre> source\n etc</pre>
  90. source\n \n etc\n
  91. <pre> source\n \n etc</pre>
  92. source\n \n etc\n\nother
  93. <pre> source\n \n etc</pre><p>other</p>
  94. = title =
  95. <h2>title</h2>
  96. ==title=
  97. <h2>title</h2>
  98. ========fnord=
  99. <h6>fnord</h6>
  100. == nada\nnada ==
  101. == nada nada ==
  102. == nada ==
  103. <pre> == nada ==</pre>
  104. ==[[Free Link]]==
  105. <h2>[[Free Link]]</h2>
  106. EOT
  107. $UseModMarkupInTitles = 1;
  108. run_tests(split('\n',<<'EOT'));
  109. ==n&auml;n==
  110. <h2>n&auml;n</h2>
  111. EOT
  112. # $HtmlLinks
  113. run_tests_negative(split('\n',<<'EOT'));
  114. <a href="http://www.emacswiki.org/">Emacs Wiki</a>
  115. &lt;a href="http://www.emacswiki.org/"&gt;Emacs Wiki&lt;a/a&gt;
  116. EOT
  117. $HtmlLinks = 1;
  118. run_tests(split('\n',<<'EOT'));
  119. <a href="http://www.emacswiki.org/">Emacs Wiki</a>
  120. <a href="http://www.emacswiki.org/">Emacs Wiki</a>
  121. EOT
  122. run_tests_negative(split('\n',<<'EOT'));
  123. <a onload="alert(document.cookie)" href="http://www.emacswiki.org"/>Emacs Wiki</a>
  124. <a onload="alert(document.cookie)" href="http://www.emacswiki.org"/>Emacs Wiki</a>
  125. EOT