Commit 46ece61c7e681775320d593864e8627db1264e18

Golmote 2015-09-03T20:19:26

Merge pull request #724 from Golmote/tests-markdown Add tests for Markdown

diff --git a/tests/languages/markdown/blockquote_feature.test b/tests/languages/markdown/blockquote_feature.test
new file mode 100644
index 0000000..3d0a4df
--- /dev/null
+++ b/tests/languages/markdown/blockquote_feature.test
@@ -0,0 +1,15 @@
+> foo
+>> foo
+> > foo
+
+----------------------------------------------------
+
+[
+	["blockquote", ">"], " foo\r\n",
+	["blockquote", ">>"], " foo\r\n",
+	["blockquote", "> >"], " foo"
+]
+
+----------------------------------------------------
+
+Checks for blockquotes.
\ No newline at end of file
diff --git a/tests/languages/markdown/bold_feature.test b/tests/languages/markdown/bold_feature.test
new file mode 100644
index 0000000..7d8e8ba
--- /dev/null
+++ b/tests/languages/markdown/bold_feature.test
@@ -0,0 +1,70 @@
+**foobar**
+**foo
+bar**
+__foobar__
+__foo
+bar__
+
+__foo*bar*baz__
+__foo_bar_baz__
+__foo[bar](baz)__
+
+----------------------------------------------------
+
+[
+	["bold", [
+		["punctuation", "**"],
+		"foobar",
+		["punctuation", "**"]
+	]],
+	["bold", [
+		["punctuation", "**"],
+		"foo\r\nbar",
+		["punctuation", "**"]
+	]],
+	["bold", [
+		["punctuation", "__"],
+		"foobar",
+		["punctuation", "__"]
+	]],
+	["bold", [
+		["punctuation", "__"],
+		"foo\r\nbar",
+		["punctuation", "__"]
+	]],
+
+	["bold", [
+		["punctuation", "__"],
+		"foo",
+		["italic", [
+			["punctuation", "*"],
+			"bar",
+			["punctuation", "*"]
+		]],
+		"baz",
+		["punctuation", "__"]
+	]],
+	["bold", [
+		["punctuation", "__"],
+		"foo",
+		["italic", [
+			["punctuation", "_"],
+			"bar",
+			["punctuation", "_"]
+		]],
+		"baz",
+		["punctuation", "__"]
+	]],
+	["bold", [
+		["punctuation", "__"],
+		"foo",
+		["url", [
+			"[bar](baz)"
+		]],
+		["punctuation", "__"]
+	]]
+]
+
+----------------------------------------------------
+
+Checks for bold. Also tests for inclusion of italic and url.
\ No newline at end of file
diff --git a/tests/languages/markdown/code_feature.test b/tests/languages/markdown/code_feature.test
new file mode 100644
index 0000000..2696ca7
--- /dev/null
+++ b/tests/languages/markdown/code_feature.test
@@ -0,0 +1,22 @@
+`foo bar baz`
+``foo `bar` baz``
+
+    foobar
+
+	foobar
+
+----------------------------------------------------
+
+[
+	["code", "`foo bar baz`"],
+	["code", "``foo `bar` baz``"],
+	["code", "    foobar"],
+	["code", "\tfoobar"]
+]
+
+----------------------------------------------------
+
+Checks for code blocks and inline code. The first code block is
+indented with 4 spaces, the second one is indented with 1 tab.
+The initial dot is necessary because of the first part being trimmed
+by the test runner.
\ No newline at end of file
diff --git a/tests/languages/markdown/hr_feature.test b/tests/languages/markdown/hr_feature.test
new file mode 100644
index 0000000..4120226
--- /dev/null
+++ b/tests/languages/markdown/hr_feature.test
@@ -0,0 +1,15 @@
+***
+---
+* * *
+
+----------------------------------------------------
+
+[
+	["hr", "***"],
+	["hr", "---"],
+	["hr", "* * *"]
+]
+
+----------------------------------------------------
+
+Checks for hr.
\ No newline at end of file
diff --git a/tests/languages/markdown/italic_feature.test b/tests/languages/markdown/italic_feature.test
new file mode 100644
index 0000000..02ced18
--- /dev/null
+++ b/tests/languages/markdown/italic_feature.test
@@ -0,0 +1,46 @@
+*foobar*
+*foo
+bar*
+_foobar_
+_foo
+bar_
+
+_foo[bar](baz)_
+
+----------------------------------------------------
+
+[
+	["italic", [
+		["punctuation", "*"],
+		"foobar",
+		["punctuation", "*"]
+	]],
+	["italic", [
+		["punctuation", "*"],
+		"foo\r\nbar",
+		["punctuation", "*"]
+	]],
+	["italic", [
+		["punctuation", "_"],
+		"foobar",
+		["punctuation", "_"]
+	]],
+	["italic", [
+		["punctuation", "_"],
+		"foo\r\nbar",
+		["punctuation", "_"]
+	]],
+
+	["italic", [
+		["punctuation", "_"],
+		"foo",
+		["url", [
+			"[bar](baz)"
+		]],
+		["punctuation", "_"]
+	]]
+]
+
+----------------------------------------------------
+
+Checks for italic. Also tests for inclusion of url.
\ No newline at end of file
diff --git a/tests/languages/markdown/list_feature.test b/tests/languages/markdown/list_feature.test
new file mode 100644
index 0000000..bfc9f8e
--- /dev/null
+++ b/tests/languages/markdown/list_feature.test
@@ -0,0 +1,22 @@
+* foo
++ bar
+- baz
+
+1. foo
+  2. bar
+42. baz
+
+----------------------------------------------------
+
+[
+	["list", "*"], " foo\r\n",
+	["list", "+"], " bar\r\n",
+	["list", "-"], " baz\r\n\r\n",
+	["list", "1."], " foo\r\n  ",
+	["list", "2."], " bar\r\n",
+	["list", "42."], " baz"
+]
+
+----------------------------------------------------
+
+Checks for list symbols.
\ No newline at end of file
diff --git a/tests/languages/markdown/title_feature.test b/tests/languages/markdown/title_feature.test
new file mode 100644
index 0000000..e02e86f
--- /dev/null
+++ b/tests/languages/markdown/title_feature.test
@@ -0,0 +1,34 @@
+title 1
+==
+
+foobar
+======
+
+title 2
+--
+
+# title 1
+## title 2
+### title 3
+#### title 4
+##### title 5
+###### title 6
+
+----------------------------------------------------
+
+[
+	["title", ["title 1\r\n", ["punctuation", "=="]]],
+	["title", ["foobar\r\n", ["punctuation", "======"]]],
+	["title", ["title 2\r\n", ["punctuation", "--"]]],
+
+	["title", [["punctuation", "#"], " title 1"]],
+	["title", [["punctuation", "##"], " title 2"]],
+	["title", [["punctuation", "###"], " title 3"]],
+	["title", [["punctuation", "####"], " title 4"]],
+	["title", [["punctuation", "#####"], " title 5"]],
+	["title", [["punctuation", "######"], " title 6"]]
+]
+
+----------------------------------------------------
+
+Checks for titles.
\ No newline at end of file
diff --git a/tests/languages/markdown/url-reference_feature.test b/tests/languages/markdown/url-reference_feature.test
new file mode 100644
index 0000000..4dc25ba
--- /dev/null
+++ b/tests/languages/markdown/url-reference_feature.test
@@ -0,0 +1,56 @@
+[foo]: http://prismjs.com
+[foo]: http://prismjs.com "foo\"bar"
+[foo]: http://prismjs.com 'foo\'bar'
+![foo]: http://prismjs.com (foo (bar\) baz)
+[foo]: <http://prismjs.com> "Prism"
+
+----------------------------------------------------
+
+[
+	["url-reference", [
+		["punctuation", "["],
+		["variable", "foo"],
+		["punctuation", "]"],
+		["punctuation", ":"],
+		" http://prismjs.com"
+	]],
+	["url-reference", [
+		["punctuation", "["],
+		["variable", "foo"],
+		["punctuation", "]"],
+		["punctuation", ":"],
+		" http://prismjs.com ",
+		["string", "\"foo\\\"bar\""]
+	]],
+	["url-reference", [
+		["punctuation", "["],
+		["variable", "foo"],
+		["punctuation", "]"],
+		["punctuation", ":"],
+		" http://prismjs.com ",
+		["string", "'foo\\'bar'"]
+	]],
+	["url-reference", [
+		["punctuation", "!"],
+		["punctuation", "["],
+		["variable", "foo"],
+		["punctuation", "]"],
+		["punctuation", ":"],
+		" http://prismjs.com ",
+		["string", "(foo (bar\\) baz)"]
+	]],
+	["url-reference", [
+		["punctuation", "["],
+		["variable", "foo"],
+		["punctuation", "]"],
+		["punctuation", ":"],
+		["punctuation", "<"],
+		"http://prismjs.com",
+		["punctuation", ">"],
+		["string", "\"Prism\""]
+	]]
+]
+
+----------------------------------------------------
+
+Checks for URL references.
\ No newline at end of file
diff --git a/tests/languages/markdown/url_feature.test b/tests/languages/markdown/url_feature.test
new file mode 100644
index 0000000..ca8b9cf
--- /dev/null
+++ b/tests/languages/markdown/url_feature.test
@@ -0,0 +1,25 @@
+[foo](http://prismjs.com)
+![foo](http://prismjs.com "Foo\"bar")
+[foo] [bar]
+
+----------------------------------------------------
+
+[
+	["url", [
+		"[foo](http://prismjs.com)"
+	]],
+	["url", [
+		"![foo](http://prismjs.com ",
+		["string", "\"Foo\\\"bar\""],
+		")"
+	]],
+	["url", [
+		"[foo] [",
+		["variable", "bar"],
+		"]"
+	]]
+]
+
+----------------------------------------------------
+
+Checks for URLs.
\ No newline at end of file