aboutsummaryrefslogtreecommitdiff
path: root/parse_wiki_text/examples/test/test_cases.rs
diff options
context:
space:
mode:
Diffstat (limited to 'parse_wiki_text/examples/test/test_cases.rs')
-rw-r--r--parse_wiki_text/examples/test/test_cases.rs726
1 files changed, 726 insertions, 0 deletions
diff --git a/parse_wiki_text/examples/test/test_cases.rs b/parse_wiki_text/examples/test/test_cases.rs
new file mode 100644
index 0000000..da7b374
--- /dev/null
+++ b/parse_wiki_text/examples/test/test_cases.rs
@@ -0,0 +1,726 @@
+// Copyright 2019 Fredrik Portström <https://portstrom.com>
+// This is free software distributed under the terms specified in
+// the file LICENSE at the top-level directory of this distribution.
+
+pub const TEST_CASES: &[(&str, &[&str])] = &[
+ (
+ "basic",
+ &[
+ "",
+ "\t",
+ "\t\n",
+ "\t alpha",
+ "\talpha",
+ "\n",
+ "\n\t",
+ "\n\n\nalpha",
+ "\n\nalpha",
+ "\n\nalpha\n\n",
+ "\n \nalpha",
+ "\nalpha",
+ "\nalpha\n",
+ " ",
+ " \n\nalpha",
+ " \nalpha",
+ " ",
+ "!!",
+ "alpha",
+ "alpha\t",
+ "alpha\n",
+ "alpha\n\t",
+ "alpha\n\n",
+ "alpha\n\n\n",
+ "alpha\n\n ",
+ "alpha\n ",
+ "alpha\n \n",
+ "alpha\nbeta",
+ "alpha ",
+ "alpha \n",
+ ],
+ ),
+ (
+ "bold italic",
+ &[
+ "'",
+ "''",
+ "'''",
+ "''''",
+ "'''''",
+ "''''''",
+ "'''''''",
+ "''''''''",
+ "'''alpha",
+ "'''alpha''",
+ "'''alpha'''",
+ "''alpha",
+ "''alpha''",
+ "''alpha'''",
+ "alpha''",
+ "alpha'''",
+ "alpha'''beta",
+ "alpha'''beta'''gamma",
+ "alpha'''beta''gamma",
+ "alpha''beta",
+ "alpha''beta'''gamma",
+ "alpha''beta''gamma",
+ ],
+ ),
+ (
+ "character entity",
+ &[
+ "&Lt;",
+ "&Ouml;",
+ "&lt",
+ "&lt&ouml;",
+ "&lt;",
+ "&lt; alpha",
+ "&lt;&ouml;",
+ "&lt;alpha",
+ "&ouml;",
+ "alpha &lt;",
+ "alpha &lt; beta",
+ "alpha&lt;",
+ "alpha&lt;beta",
+ ],
+ ),
+ (
+ "comment",
+ &[
+ "<!--",
+ "<!---->",
+ "<!---->beta",
+ "<!--->beta",
+ "<!--<!--alpha-->-->beta",
+ "<!--alpha-->",
+ "<!--alpha--> beta",
+ "<!--alpha--><!--beta",
+ "<!--alpha--><!--beta-->",
+ "<!--alpha-->beta",
+ "<!-<!--alpha-->beta",
+ "alpha <!--beta",
+ "alpha<!--beta",
+ ],
+ ),
+ (
+ "external link",
+ &[
+ "[//alpha",
+ "[//alpha beta\ngamma]",
+ "[//alpha beta]",
+ "[//alpha]",
+ "[//alpha] beta",
+ "[//alpha]beta",
+ "[HTTP://alpha]",
+ "[Http://alpha]",
+ "[alpha://beta]",
+ "[hTtP://alpha]",
+ "[http://alpha]",
+ "[http:/alpha]",
+ "[http:alpha]",
+ "[https://alpha]",
+ "[sip:alpha]",
+ "alpha [//beta]",
+ "alpha [//beta] gamma",
+ "alpha[//beta]",
+ "alpha[//beta]gamma",
+ ],
+ ),
+ (
+ "heading",
+ &[
+ "=",
+ "= =",
+ "= alpha =",
+ "=''=",
+ "==",
+ "== ''=",
+ "== alpha''=",
+ "==''=",
+ "===",
+ "====",
+ "=====",
+ "======",
+ "========alpha========",
+ "=======alpha======",
+ "=======alpha=======",
+ "======alpha======",
+ "=====alpha=====",
+ "====alpha====",
+ "===alpha===",
+ "==alpha''=",
+ "==alpha=",
+ "==alpha==",
+ "=alpha",
+ "=alpha\nbeta=",
+ "=alpha=",
+ "=alpha=\n\n\nbeta",
+ "=alpha=\n\n=beta=",
+ "=alpha=\n\nbeta",
+ "=alpha=\n=beta=",
+ "=alpha=\nbeta",
+ "=alpha= \nbeta",
+ "=alpha==",
+ "alpha\t\n=beta=",
+ "alpha\n\n=beta=",
+ "alpha\n\n=beta=\n\ngamma",
+ "alpha\n=beta=",
+ "alpha\n=beta=\ngamma",
+ "alpha \n=beta=",
+ ],
+ ),
+ (
+ "horizontal divider",
+ &[
+ "----",
+ "----\t\nalpha",
+ "----\n\n\n----",
+ "----\n\n\nalpha",
+ "----\n\n----",
+ "----\n\nalpha",
+ "----\n----",
+ "----\nalpha",
+ "---- \nalpha",
+ "-----",
+ "------",
+ "----alpha",
+ "alpha\t\n----",
+ "alpha\n\n\n----",
+ "alpha\n\n----",
+ "alpha\n \n----",
+ "alpha\n----",
+ "alpha \n----",
+ ],
+ ),
+ ("invalid character", &["\0", "\r", "\x7f"]),
+ (
+ "link",
+ &[
+ "[[FILE:alpha]]",
+ "[[File:alpha]]",
+ "[[alpha",
+ "[[alpha:beta]]",
+ "[[alpha:beta]]gamma",
+ "[[alpha]]",
+ "[[alpha]] beta",
+ "[[alpha]]beta",
+ "[[alpha]]beta gamma",
+ "[[alpha]]ü",
+ "[[alpha|",
+ "[[alpha|[beta]gamma]]",
+ "[[alpha|]]",
+ "[[alpha|beta",
+ "[[alpha|beta\ngamma]]",
+ "[[alpha|beta[[gamma]]]]",
+ "[[alpha|beta]]",
+ "[[alpha|beta]]gamma",
+ "[[category:alpha]]",
+ "[[category:alpha]]beta",
+ "[[category:alpha|beta]]",
+ "[[file:alpha]]",
+ "[[file:alpha]]beta",
+ "[[file:alpha|[[beta]]]]",
+ "[[file:alpha|[[beta]]gamma]]",
+ "[[file:alpha|]]",
+ "[[file:alpha|beta[[gamma]]]]",
+ "[[file:alpha|beta]]",
+ "[[file:alpha|beta]]gamma",
+ "[[image:alpha]]",
+ "[[|]]",
+ "[[|alpha]]",
+ "alpha [[beta]]",
+ "alpha[[beta]]",
+ "alpha[[beta]]gamma",
+ ],
+ ),
+ (
+ "list",
+ &[
+ "#",
+ "#\n\n\nalpha",
+ "#\n\nalpha",
+ "#\n#",
+ "#\n##",
+ "#\n##\n#",
+ "#\n*",
+ "#\n:",
+ "#\n;",
+ "#\nalpha",
+ "# alpha",
+ "##",
+ "##\n#",
+ "##\n#\n##",
+ "##\n##",
+ "#=alpha=",
+ "#alpha",
+ "#alpha\n#beta",
+ "*",
+ "*\n\nalpha",
+ "*\n#",
+ "*\n*",
+ "*\n**",
+ "*\n**\n*",
+ "*\n:",
+ "*\n;",
+ "*\nalpha",
+ "* alpha",
+ "* alpha\n* beta",
+ "**",
+ "**\n*",
+ "**\n*\n**",
+ "**\n**",
+ "*;\n*;",
+ "*;\n*;*",
+ "*;*\n*;",
+ "*;*\n*;#",
+ "*=alpha=",
+ "*alpha",
+ "*alpha\n*beta",
+ ":",
+ ":\n\nalpha",
+ ":\n#",
+ ":\n*",
+ ":\n:",
+ ":\n::",
+ ":\n::\n:",
+ ":\n;",
+ ":\nalpha",
+ ": alpha",
+ "::",
+ "::\n:",
+ "::\n:\n::",
+ "::\n::",
+ ":=alpha=",
+ ":alpha",
+ ":alpha\nbeta",
+ ";",
+ ";\n\nalpha",
+ ";\n#",
+ ";\n*",
+ ";\n:",
+ ";\n;;",
+ ";\n;;\n;",
+ ";\nalpha",
+ "; alpha",
+ ";;",
+ ";;\n;",
+ ";;\n;\n;;",
+ ";;\n;;",
+ ";=alpha=",
+ ";alpha",
+ ";alpha\nbeta",
+ "alpha\t\n#",
+ "alpha\n#",
+ "alpha\n#\nbeta",
+ "alpha\n*",
+ "alpha\n*\nbeta",
+ "alpha\n:",
+ "alpha\n:\nbeta",
+ "alpha\n;",
+ "alpha\n;\nbeta",
+ "alpha \n#",
+ ],
+ ),
+ (
+ "magic word",
+ &[
+ "__ALPHA__",
+ "__NOTC__ __TOC__",
+ "__NOTC___TOC__",
+ "__NOTC____TOC__",
+ "__TOC_",
+ "__TOC__",
+ "__TOC__ alpha",
+ "__TOC__alpha",
+ "__ToC__",
+ "__tOc__",
+ "__toc__",
+ "alpha __TOC__",
+ "alpha __TOC__ beta",
+ "alpha__TOC__",
+ "alpha__TOC__beta",
+ ],
+ ),
+ (
+ "mix",
+ &[
+ " alpha\n {|\n beta\n |}\n gamma",
+ " alpha\n {|\n|}",
+ " alpha\n |}",
+ " alpha\n |}\n beta",
+ " {|\n alpha\n |}",
+ " {|\n alpha\n|}",
+ "*\n alpha\n*",
+ "----\t\n*",
+ "----\n\n*",
+ "----\n*",
+ "----\n*\nalpha",
+ "---- \n*",
+ "<ref><!--",
+ "=alpha=\n\n----",
+ "=alpha=\n----",
+ "{{alpha|<!--",
+ "{|\n alpha\n |}",
+ "{|\n alpha\n|}",
+ "{|\n|}\t\n*",
+ "{|\n|}\n*",
+ "{|\n|}\n*\nalpha",
+ "{|\n|} \n*",
+ ],
+ ),
+ (
+ "nowiki",
+ &[
+ "<MATH>''</MATH>",
+ "<NOWIKI>''</NOWIKI>",
+ "<mAtH>''</MaTh>",
+ "<math>''</math>",
+ "<math>''alpha",
+ "<nOwIkI>''</NoWiKi>",
+ "<nowiki>\n*alpha\n</nowiki>",
+ "<nowiki>\n=alpha=\n</nowiki>",
+ "<nowiki>''</nowiki>",
+ "<nowiki>''alpha",
+ "<nowiki><!-- alpha --></nowiki>",
+ "<nowiki>{{</nowiki>",
+ "<nowiki>{{alpha}}</nowiki>",
+ "<nowiki>}}</nowiki>",
+ ],
+ ),
+ (
+ "paragraph break",
+ &[
+ "alpha\t\n\nbeta",
+ "alpha\n\t\nbeta",
+ "alpha\n\n\t beta",
+ "alpha\n\n\tbeta",
+ "alpha\n\n\n\nbeta",
+ "alpha\n\n\nbeta",
+ "alpha\n\nbeta",
+ "alpha\n \nbeta",
+ "alpha \n\nbeta",
+ ],
+ ),
+ (
+ "parameter",
+ &[
+ "*alpha}}}",
+ "[[alpha|beta}}}]]",
+ "{{{",
+ "{{{\talpha}}}",
+ "{{{\nalpha}}}",
+ "{{{''}}}",
+ "{{{[[alpha|beta}}}",
+ "{{{alpha\t|beta}}}",
+ "{{{alpha\t}}}",
+ "{{{alpha\n|beta}}}",
+ "{{{alpha\n}}}",
+ "{{{alpha |beta}}}",
+ "{{{alpha }}}",
+ "{{{alpha|",
+ "{{{alpha|\tbeta}}}",
+ "{{{alpha|\t|}}}",
+ "{{{alpha|\t}}}",
+ "{{{alpha|\nbeta}}}",
+ "{{{alpha|\n|}}}",
+ "{{{alpha|\n}}}",
+ "{{{alpha| beta|}}}",
+ "{{{alpha| |}}}",
+ "{{{alpha| }}}",
+ "{{{alpha|beta\t|}}}",
+ "{{{alpha|beta\n|}}}",
+ "{{{alpha|beta |}}}",
+ "{{{alpha|beta|",
+ "{{{alpha|beta|\n}}}",
+ "{{{alpha|beta|gamma}}}",
+ "{{{alpha|beta|}}}",
+ "{{{alpha|beta}}}",
+ "{{{alpha|}}}",
+ "{{{alpha}}}",
+ "{{{|''}}}",
+ "{{{||}}}",
+ "{{{|}}}",
+ "{{{}}}",
+ "}}}",
+ ],
+ ),
+ (
+ "preformatted block",
+ &[
+ " alpha",
+ " alpha",
+ " alpha\n\n\nbeta",
+ " alpha\n\nbeta",
+ " alpha\n beta",
+ " alpha\n beta\n gamma",
+ " alpha\n beta\ngamma",
+ " alpha\nbeta",
+ " alpha\nbeta\n gamma",
+ "alpha\t\n beta",
+ "alpha\n\n beta",
+ "alpha\n \n beta",
+ "alpha\n =beta=\ngamma",
+ "alpha\n beta",
+ "alpha\n beta\n gamma",
+ "alpha\n beta\ngamma",
+ "alpha \n beta",
+ ],
+ ),
+ (
+ "redirect",
+ &[
+ "\t#REDIRECT[[alpha]]",
+ "\n\n#REDIRECT[[alpha]]",
+ "\n #REDIRECT[[alpha]]",
+ "\n#REDIRECT [[alpha]]",
+ " \n#REDIRECT[[alpha]]",
+ " #REDIRECT[[alpha]]",
+ " #REDIRECT[[alpha]]",
+ "#REDIRECT\t:[[alpha]]",
+ "#REDIRECT\t[[alpha]]",
+ "#REDIRECT\n\n[[alpha]]",
+ "#REDIRECT\n [[alpha]]",
+ "#REDIRECT\n:\n[[alpha]]",
+ "#REDIRECT\n:[[alpha]]",
+ "#REDIRECT\n[[alpha]]",
+ "#REDIRECT \n[[alpha]]",
+ "#REDIRECT [[alpha]]",
+ "#REDIRECT : [[alpha]]",
+ "#REDIRECT :[[alpha]]",
+ "#REDIRECT [[alpha]]",
+ "#REDIRECT:\t[[alpha]]",
+ "#REDIRECT:\n[[alpha]]",
+ "#REDIRECT: [[alpha]]",
+ "#REDIRECT:[[alpha]]",
+ "#REDIRECT[[alpha]]",
+ "#REDIRECT[[alpha]]\n\nbeta",
+ "#REDIRECT[[alpha]]\n beta",
+ "#REDIRECT[[alpha]]\nbeta",
+ "#REDIRECT[[alpha]] \nbeta",
+ "#REDIRECT[[alpha]] beta",
+ "#REDIRECT[[alpha]] beta",
+ "#REDIRECT[[alpha]]''beta",
+ "#REDIRECT[[alpha]]beta",
+ "#REDIRECT[[alpha|]]",
+ "#REDIRECT[[alpha|]]beta",
+ "#REDIRECT[[alpha|beta\ngamma]]",
+ "#REDIRECT[[alpha|beta]]",
+ "#REDIRECT[[alpha|beta]]=gamma=",
+ "#REDIRECT[[alpha|beta]]gamma",
+ "#ReDiReCt[[alpha]]",
+ "#rEdIrEcT[[alpha]]",
+ "#redirect[[alpha]]",
+ ],
+ ),
+ (
+ "table",
+ &[
+ " {|\n |}",
+ " {|\n|}",
+ "alpha\n{|\nbeta\n|}",
+ "{|",
+ "{|\n |}",
+ "{|\n!\n alpha\n|}",
+ "{|\n!\n!\n|}",
+ "{|\n!\nalpha\n\nbeta\n|}",
+ "{|\n!\nalpha\n\n|}",
+ "{|\n!\nalpha\nbeta\n|}",
+ "{|\n!\nalpha \n|}",
+ "{|\n!\n|\n|}",
+ "{|\n!\n|-\n|}",
+ "{|\n!\n|}",
+ "{|\n! alpha\n|}",
+ "{|\n!!\n|}",
+ "{|\n!!!\n|}",
+ "{|\n!!!!\n|}",
+ "{|\n!!!|\n|}",
+ "{|\n!alpha\n\nbeta\n|}",
+ "{|\n!alpha\nbeta\n|}",
+ "{|\n!alpha\nbeta|gamma\n|}",
+ "{|\n!alpha\n|}",
+ "{|\n!alpha!!beta\n|}",
+ "{|\n!alpha!beta\n|}",
+ "{|\n!alpha|beta\n|}",
+ "{|\n!alpha||beta\n|}",
+ "{|\n!|\n|}",
+ "{|\n!|!!\n|}",
+ "{|\n!|alpha\n|}",
+ "{|\n!|alpha|beta\n|}",
+ "{|\n!||\n|}",
+ "{|\n!||alpha\n|}",
+ "{|\n!|||\n|}",
+ "{|\n*alpha\n|}",
+ "{|\n=alpha=\n|}",
+ "{|\nalpha\n|}",
+ "{|\n|",
+ "{|\n|\n alpha\n|}",
+ "{|\n|\n!\n|}",
+ "{|\n|\n*alpha\n|}",
+ "{|\n|\n=alpha=\n|}",
+ "{|\n|\nalpha\n\nbeta\n|}",
+ "{|\n|\nalpha\n\n|}",
+ "{|\n|\nalpha\nbeta\n|}",
+ "{|\n|\nalpha \n|}",
+ "{|\n|\n|\n|}",
+ "{|\n|\n|-\n|}",
+ "{|\n|\n|}",
+ "{|\n| alpha\n|}",
+ "{|\n|+\n alpha\n|}",
+ "{|\n|+\n*alpha\n|}",
+ "{|\n|+\n=alpha=\n|}",
+ "{|\n|+\nalpha\n\nbeta\n|}",
+ "{|\n|+\nalpha\nbeta\n|}",
+ "{|\n|+\nalpha\n|}",
+ "{|\n|+\n|+\n|}",
+ "{|\n|+\n|}",
+ "{|\n|+ alpha\n|}",
+ "{|\n|+!!\n|}",
+ "{|\n|+alpha\n\nbeta\n|}",
+ "{|\n|+alpha\nbeta\n|}",
+ "{|\n|+alpha\n|}",
+ "{|\n|+alpha \n|}",
+ "{|\n|+|\n|}",
+ "{|\n|+|alpha|\n|}",
+ "{|\n|+|alpha|beta\n|}",
+ "{|\n|+||\n|}",
+ "{|\n|+||alpha\n|}",
+ "{|\n|+|||\n|}",
+ "{|\n|-\n alpha\n|}",
+ "{|\n|-\n!\n|}",
+ "{|\n|-\n*alpha\n|}",
+ "{|\n|-\n=alpha=\n|}",
+ "{|\n|-\nalpha\n|}",
+ "{|\n|-\n|\n|}",
+ "{|\n|-\n|-\n|}",
+ "{|\n|-\n|}",
+ "{|\n|- alpha\n|}",
+ "{|\n|-alpha\n\n|}",
+ "{|\n|-alpha\n|}",
+ "{|\n|-alpha \n|}",
+ "{|\n|alpha\n\nbeta\n|}",
+ "{|\n|alpha\nbeta\n|}",
+ "{|\n|alpha\nbeta|gamma\n|}",
+ "{|\n|alpha\n|}",
+ "{|\n|alpha!!beta\n|}",
+ "{|\n|alpha!beta\n|}",
+ "{|\n|alpha|\n|}",
+ "{|\n|alpha|beta\n|}",
+ "{|\n|alpha||beta\n|}",
+ "{|\n||\n|}",
+ "{|\n||alpha\n|}",
+ "{|\n|||\n|}",
+ "{|\n||||\n|}",
+ "{|\n|}",
+ "{|\n|}\t\nalpha",
+ "{|\n|}\n\n\nalpha",
+ "{|\n|}\n\nalpha",
+ "{|\n|}\nalpha",
+ "{|\n|} \nalpha",
+ "{|\n|}alpha",
+ "{|alpha\nbeta\n|}",
+ "{|alpha\n|}",
+ ],
+ ),
+ (
+ "tag",
+ &[
+ "</BR>",
+ "</Br>",
+ "</alpha",
+ "</alpha>",
+ "</b",
+ "</b alpha>",
+ "</b alpha>beta",
+ "</b</b>",
+ "</b<b>",
+ "</b>",
+ "</b> alpha",
+ "</b>alpha",
+ "</br\t>",
+ "</br\n>",
+ "</br >",
+ "</br>",
+ "</ref",
+ "<BR>",
+ "<Br>",
+ "<alpha",
+ "<alpha>",
+ "<b",
+ "<b alpha>",
+ "<b alpha>beta",
+ "<b</b>",
+ "<b<b>",
+ "<b>",
+ "<b> alpha",
+ "<b>alpha",
+ "<br\t>",
+ "<br\n>",
+ "<br >",
+ "<br>",
+ "<r<ref>alpha</ref>beta",
+ "<ref",
+ "<ref />",
+ "<ref >",
+ "<ref/>",
+ "<ref>",
+ "<ref>\talpha</ref>",
+ "<ref>\nalpha</ref>",
+ "<ref> alpha</ref>",
+ "<ref></ref>",
+ "<ref>alpha\t</ref>",
+ "<ref>alpha\n</ref>",
+ "<ref>alpha </ref>",
+ "<ref>alpha</ref>",
+ "alpha<b>",
+ ],
+ ),
+ (
+ "template",
+ &[
+ "*alpha}}",
+ "[[alpha|beta}}]]",
+ "alpha {{beta}}",
+ "alpha {{beta}} gamma",
+ "alpha{{beta}}",
+ "alpha{{beta}}gamma",
+ "{{\nalpha}}",
+ "{{''}}",
+ "{{[[alpha|beta}}",
+ "{{alpha",
+ "{{alpha\n|beta}}",
+ "{{alpha\n|}}",
+ "{{alpha\n}}",
+ "{{alpha|",
+ "{{alpha|\nbeta}}",
+ "{{alpha|\n}}",
+ "{{alpha| beta}}",
+ "{{alpha|''}}",
+ "{{alpha|beta",
+ "{{alpha|beta\n=gamma}}",
+ "{{alpha|beta\n}}",
+ "{{alpha|beta =gamma}}",
+ "{{alpha|beta }}",
+ "{{alpha|beta=\ngamma}}",
+ "{{alpha|beta= gamma}}",
+ "{{alpha|beta=gamma\n}}",
+ "{{alpha|beta=gamma }}",
+ "{{alpha|beta=gamma=delta}}",
+ "{{alpha|beta=gamma|delta=epsilon}}",
+ "{{alpha|beta=gamma|delta}}",
+ "{{alpha|beta=gamma}}",
+ "{{alpha|beta=}}",
+ "{{alpha|beta|gamma=delta}}",
+ "{{alpha|beta|gamma}}",
+ "{{alpha|beta}",
+ "{{alpha|beta}}",
+ "{{alpha|beta}} gamma",
+ "{{alpha|beta}}gamma",
+ "{{alpha|}",
+ "{{alpha|}}",
+ "{{alpha}",
+ "{{alpha}}",
+ "{{alpha}} beta",
+ "{{alpha}}beta",
+ "}}",
+ ],
+ ),
+];