creoleaddition.t 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. #!/usr/bin/env perl
  2. # Copyright (C) 2008 Weakish Jiang <weakish@gmail.com>
  3. # Copyright (C) 2009-2013 Alex Schroeder <alex@gnu.com>
  4. #
  5. # This program is free software; you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License version 2 as
  7. # published by the Free Software Foundation.
  8. #
  9. # You can get a copy of GPL version 2 at
  10. # http://www.gnu.org/licenses/gpl-2.0.html
  11. # $Id: creoleaddition.t,v 1.15 2009/02/27 09:56:05 as Exp $
  12. require './t/test.pl';
  13. package OddMuse;
  14. use Test::More tests => 29;
  15. add_module('creole.pl');
  16. add_module('creoleaddition.pl');
  17. run_tests(split('\n',<<'EOT'));
  18. x^^2^^
  19. x<sup>2</sup>
  20. H,,2,,O
  21. H<sub>2</sub>O
  22. ;dt1\n:dd1\n;dt2\n:dd2
  23. <dl><dt>dt1</dt><dd>dd1</dd><dt>dt2</dt><dd>dd2</dd></dl>
  24. ;dt1\n:dd1
  25. <dl><dt>dt1</dt><dd>dd1</dd></dl>
  26. ;dt1\n: dd1
  27. <dl><dt>dt1</dt><dd>dd1</dd></dl>
  28. ; dt1\n: dd1
  29. <dl><dt>dt1</dt><dd>dd1</dd></dl>
  30. ;;dt1\n:dd1
  31. <dl><dt>;dt1</dt><dd>dd1</dd></dl>
  32. ;dt1\n:dd1\nmore dd1\n;dt2\n:dd2\n more dd2
  33. <dl><dt>dt1</dt><dd>dd1 more dd1</dd><dt>dt2</dt><dd>dd2 more dd2</dd></dl>
  34. ; one:eins\n;two:zwei
  35. ; one:eins ;two:zwei
  36. ; one:eins
  37. ; one:eins
  38. ; one:eins\n\n; two:zwei
  39. ; one:eins<p>; two:zwei</p>
  40. ; dt1 :dd1
  41. ; dt1 :dd1
  42. ; dt1\n:dd1
  43. <dl><dt>dt1</dt><dd>dd1</dd></dl>
  44. ; dt1 \n : dd1 \n ; dt2 \n : dd2
  45. <dl><dt>dt1</dt><dd>dd1</dd><dt>dt2</dt><dd>dd2</dd></dl>
  46. ;dt1\n:dd1\n:dd2
  47. <dl><dt>dt1</dt><dd>dd1</dd><dd>dd2</dd></dl>
  48. ;dt1 \n :dd1\n:dd2\n : dd3
  49. <dl><dt>dt1</dt><dd>dd1</dd><dd>dd2</dd><dd>dd3</dd></dl>
  50. ; **dt1**\n:dd1
  51. <dl><dt><strong>dt1</strong></dt><dd>dd1</dd></dl>
  52. ; {{{dt1}}}\n:dd1
  53. <dl><dt><code>dt1</code></dt><dd>dd1</dd></dl>
  54. ; {{{[[http://www.toto.com|toto]]}}} \n : Site of my friend Toto
  55. <dl><dt><code>[[http://www.toto.com|toto]]</code></dt><dd>Site of my friend Toto</dd></dl>
  56. ; what if we have {{{[[http://example.com]]}}} and {{{[[ftp://example.org]]}}}\n: And {{{[[http://example.net]]}}}
  57. <dl><dt>what if we have <code>[[http://example.com]]</code> and <code>[[ftp://example.org]]</code></dt><dd>And <code>[[http://example.net]]</code></dd></dl>
  58. ;dt:notdd\n:dd
  59. <dl><dt>dt:notdd</dt><dd>dd</dd></dl>
  60. ''my quote'' works ''what about x^^2^^''
  61. <q>my quote</q> works <q>what about x<sup>2</sup></q>
  62. """ not a block quote """
  63. """ not a block quote """
  64. """\nmy block quote\n"""
  65. <blockquote><p>my block quote </p></blockquote>
  66. ##monospace code##
  67. <code>monospace code</code>
  68. EOT
  69. xpath_run_tests(split('\n',<<'EOT'));
  70. ;[[http://www.toto.com|toto]] \n :Site of my friend Toto
  71. //dl/dt[a[@class="url http outside"][@href="http://www.toto.com"][text()="toto"]]/following-sibling::dd[text()="Site of my friend Toto"]
  72. ##http://example.com##
  73. //code/a[@class="url http"][@href="http://example.com"][text()="http://example.com"]
  74. ##[[wiki page]] will work##
  75. //code/a[@class="edit"][@title="Click to edit this page"][@href="http://localhost/test.pl?action=edit;id=wiki_page"][text()="?"][@rel="nofollow"]
  76. EOT
  77. # test for interaction with the usemod indented text rules
  78. add_module('usemod.pl');
  79. xpath_run_tests(split('\n',<<'EOT'));
  80. : is working\n:: not working
  81. //p[@class="indent level1"][@style="margin-left: 2em"][text()="is working "]/following-sibling::p[@class="indent level2"][@style="margin-left: 4em"][text()="not working"]
  82. EOT
  83. exit;