all repos — grayfriday @ 646308596abc3fd896ed699fee08a546c89e0116

blackfriday fork with a few changes

Run tests in parallel (#480)

Fixes #475
Cameron Moore moorereason@gmail.com
Fri, 07 Sep 2018 16:47:14 -0500
commit

646308596abc3fd896ed699fee08a546c89e0116

parent

2ab1ea34bddcd35ff0e99c25ff8b169ef5777cb4

5 files changed, 64 insertions(+), 0 deletions(-)

jump to
M block_test.goblock_test.go

@@ -19,6 +19,7 @@ "testing"

) func TestPrefixHeaderNoExtensions(t *testing.T) { + t.Parallel() var tests = []string{ "# Header 1\n", "<h1>Header 1</h1>\n",

@@ -88,6 +89,7 @@ doTestsBlock(t, tests, 0)

} func TestPrefixHeaderSpaceExtension(t *testing.T) { + t.Parallel() var tests = []string{ "# Header 1\n", "<h1>Header 1</h1>\n",

@@ -148,6 +150,7 @@ doTestsBlock(t, tests, SpaceHeadings)

} func TestPrefixHeaderIdExtension(t *testing.T) { + t.Parallel() var tests = []string{ "# Header 1 {#someid}\n", "<h1 id=\"someid\">Header 1</h1>\n",

@@ -208,6 +211,7 @@ doTestsBlock(t, tests, HeadingIDs)

} func TestPrefixHeaderIdExtensionWithPrefixAndSuffix(t *testing.T) { + t.Parallel() var tests = []string{ "# header 1 {#someid}\n", "<h1 id=\"PRE:someid:POST\">header 1</h1>\n",

@@ -260,6 +264,7 @@ })

} func TestPrefixAutoHeaderIdExtension(t *testing.T) { + t.Parallel() var tests = []string{ "# Header 1\n", "<h1 id=\"header-1\">Header 1</h1>\n",

@@ -311,6 +316,7 @@ doTestsBlock(t, tests, AutoHeadingIDs)

} func TestPrefixAutoHeaderIdExtensionWithPrefixAndSuffix(t *testing.T) { + t.Parallel() var tests = []string{ "# Header 1\n", "<h1 id=\"PRE:header-1:POST\">Header 1</h1>\n",

@@ -372,6 +378,7 @@ })

} func TestPrefixHeaderLevelOffset(t *testing.T) { + t.Parallel() var offsetTests = []struct { offset int tests []string

@@ -458,6 +465,7 @@ }

} func TestPrefixMultipleHeaderExtensions(t *testing.T) { + t.Parallel() var tests = []string{ "# Header\n\n# Header {#header}\n\n# Header 1", "<h1 id=\"header\">Header</h1>\n\n<h1 id=\"header-1\">Header</h1>\n\n<h1 id=\"header-1-1\">Header 1</h1>\n",

@@ -466,6 +474,7 @@ doTestsBlock(t, tests, AutoHeadingIDs|HeadingIDs)

} func TestUnderlineHeaders(t *testing.T) { + t.Parallel() var tests = []string{ "Header 1\n========\n", "<h1>Header 1</h1>\n",

@@ -516,6 +525,7 @@ doTestsBlock(t, tests, 0)

} func TestUnderlineHeadersAutoIDs(t *testing.T) { + t.Parallel() var tests = []string{ "Header 1\n========\n", "<h1 id=\"header-1\">Header 1</h1>\n",

@@ -566,6 +576,7 @@ doTestsBlock(t, tests, AutoHeadingIDs)

} func TestHorizontalRule(t *testing.T) { + t.Parallel() var tests = []string{ "-\n", "<p>-</p>\n",

@@ -631,6 +642,7 @@ doTestsBlock(t, tests, 0)

} func TestUnorderedList(t *testing.T) { + t.Parallel() var tests = []string{ "* Hello\n", "<ul>\n<li>Hello</li>\n</ul>\n",

@@ -742,6 +754,7 @@ doTestsBlock(t, tests, 0)

} func TestOrderedList(t *testing.T) { + t.Parallel() var tests = []string{ "1. Hello\n", "<ol>\n<li>Hello</li>\n</ol>\n",

@@ -838,6 +851,7 @@ doTestsBlock(t, tests, 0)

} func TestDefinitionList(t *testing.T) { + t.Parallel() var tests = []string{ "Term 1\n: Definition a\n", "<dl>\n<dt>Term 1</dt>\n<dd>Definition a</dd>\n</dl>\n",

@@ -940,6 +954,7 @@ doTestsBlock(t, tests, DefinitionLists)

} func TestConsecutiveLists(t *testing.T) { + t.Parallel() var tests = []string{ "1. Hello\n\n* Hello\n\nTerm 1\n: Definition a\n", "<ol>\n<li>Hello</li>\n</ol>\n\n<ul>\n<li>Hello</li>\n</ul>\n\n<dl>\n<dt>Term 1</dt>\n<dd>Definition a</dd>\n</dl>\n",

@@ -951,6 +966,7 @@ doTestsBlock(t, tests, DefinitionLists)

} func TestPreformattedHtml(t *testing.T) { + t.Parallel() var tests = []string{ "<div></div>\n", "<div></div>\n",

@@ -1004,6 +1020,7 @@ doTestsBlock(t, tests, 0)

} func TestPreformattedHtmlLax(t *testing.T) { + t.Parallel() var tests = []string{ "Paragraph\n<div>\nHere? >&<\n</div>\n", "<p>Paragraph</p>\n\n<div>\nHere? >&<\n</div>\n",

@@ -1027,6 +1044,7 @@ doTestsBlock(t, tests, LaxHTMLBlocks)

} func TestFencedCodeBlock(t *testing.T) { + t.Parallel() var tests = []string{ "``` go\nfunc foo() bool {\n\treturn true;\n}\n```\n", "<pre><code class=\"language-go\">func foo() bool {\n\treturn true;\n}\n</code></pre>\n",

@@ -1122,6 +1140,7 @@ doTestsBlock(t, tests, FencedCode)

} func TestFencedCodeInsideBlockquotes(t *testing.T) { + t.Parallel() cat := func(s ...string) string { return strings.Join(s, "\n") } var tests = []string{ cat("> ```go",

@@ -1234,6 +1253,7 @@ doTestsBlock(t, tests, FencedCode)

} func TestTable(t *testing.T) { + t.Parallel() var tests = []string{ "a | b\n---|---\nc | d\n", "<table>\n<thead>\n<tr>\n<th>a</th>\n<th>b</th>\n</tr>\n</thead>\n\n" +

@@ -1281,6 +1301,7 @@ doTestsBlock(t, tests, Tables)

} func TestUnorderedListWith_EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK(t *testing.T) { + t.Parallel() var tests = []string{ "* Hello\n", "<ul>\n<li>Hello</li>\n</ul>\n",

@@ -1392,6 +1413,7 @@ doTestsBlock(t, tests, NoEmptyLineBeforeBlock)

} func TestOrderedList_EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK(t *testing.T) { + t.Parallel() var tests = []string{ "1. Hello\n", "<ol>\n<li>Hello</li>\n</ol>\n",

@@ -1488,6 +1510,7 @@ doTestsBlock(t, tests, NoEmptyLineBeforeBlock)

} func TestFencedCodeBlock_EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK(t *testing.T) { + t.Parallel() var tests = []string{ "``` go\nfunc foo() bool {\n\treturn true;\n}\n```\n", "<pre><code class=\"language-go\">func foo() bool {\n\treturn true;\n}\n</code></pre>\n",

@@ -1562,6 +1585,7 @@ doTestsBlock(t, tests, FencedCode|NoEmptyLineBeforeBlock)

} func TestListWithFencedCodeBlock(t *testing.T) { + t.Parallel() var tests = []string{ "1. one\n\n ```\n code\n ```\n\n2. two\n", "<ol>\n<li><p>one</p>\n\n<pre><code>code\n</code></pre></li>\n\n<li><p>two</p></li>\n</ol>\n",

@@ -1573,6 +1597,7 @@ doTestsBlock(t, tests, FencedCode)

} func TestListWithMalformedFencedCodeBlock(t *testing.T) { + t.Parallel() // Ensure that in the case of an unclosed fenced code block in a list, // no source gets ommitted (even if it is malformed). // See russross/blackfriday#372 for context.

@@ -1587,6 +1612,7 @@ doTestsBlock(t, tests, FencedCode)

} func TestListWithFencedCodeBlockNoExtensions(t *testing.T) { + t.Parallel() // If there is a fenced code block in a list, and FencedCode is not set, // lists should be processed normally. var tests = []string{

@@ -1600,6 +1626,7 @@ doTestsBlock(t, tests, 0)

} func TestTitleBlock_EXTENSION_TITLEBLOCK(t *testing.T) { + t.Parallel() var tests = []string{ "% Some title\n" + "% Another title line\n" +

@@ -1614,6 +1641,7 @@ doTestsBlock(t, tests, Titleblock)

} func TestBlockComments(t *testing.T) { + t.Parallel() var tests = []string{ "Some text\n\n<!-- comment -->\n", "<p>Some text</p>\n\n<!-- comment -->\n",

@@ -1628,6 +1656,7 @@ doTestsBlock(t, tests, 0)

} func TestTOC(t *testing.T) { + t.Parallel() var tests = []string{ "# Title\n\n##Subtitle1\n\n##Subtitle2", //"<nav>\n<ul>\n<li><a href=\"#toc_0\">Title</a>\n<ul>\n<li><a href=\"#toc_1\">Subtitle1</a></li>\n<li><a href=\"#toc_2\">Subtitle2</a></li>\n</ul></li>\n</ul>\n</nav>\n\n<h1 id=\"toc_0\">Title</h1>\n\n<h2 id=\"toc_1\">Subtitle1</h2>\n\n<h2 id=\"toc_2\">Subtitle2</h2>\n",

@@ -1748,6 +1777,7 @@ })

} func TestCompletePage(t *testing.T) { + t.Parallel() var tests = []string{ "*foo*", `<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

@@ -1769,6 +1799,7 @@ doTestsParam(t, tests, TestParams{HTMLFlags: UseXHTML | CompletePage})

} func TestIsFenceLine(t *testing.T) { + t.Parallel() tests := []struct { data []byte infoRequested bool
M esc_test.goesc_test.go

@@ -6,6 +6,7 @@ "testing"

) func TestEsc(t *testing.T) { + t.Parallel() tests := []string{ "abc", "abc", "a&c", "a&amp;c",
M inline_test.goinline_test.go

@@ -21,6 +21,7 @@ "strings"

) func TestEmphasis(t *testing.T) { + t.Parallel() var tests = []string{ "nothing inline\n", "<p>nothing inline</p>\n",

@@ -77,6 +78,7 @@ doTestsInline(t, tests)

} func TestReferenceOverride(t *testing.T) { + t.Parallel() var tests = []string{ "test [ref1][]\n", "<p>test <a href=\"http://www.ref1.com/\" title=\"Reference 1\">ref1</a></p>\n",

@@ -135,6 +137,7 @@ })

} func TestStrong(t *testing.T) { + t.Parallel() var tests = []string{ "nothing inline\n", "<p>nothing inline</p>\n",

@@ -194,6 +197,7 @@ doTestsInline(t, tests)

} func TestEmphasisMix(t *testing.T) { + t.Parallel() var tests = []string{ "***triple emphasis***\n", "<p><strong><em>triple emphasis</em></strong></p>\n",

@@ -223,6 +227,7 @@ doTestsInline(t, tests)

} func TestEmphasisLink(t *testing.T) { + t.Parallel() var tests = []string{ "[first](before) *text[second] (inside)text* [third](after)\n", "<p><a href=\"before\">first</a> <em>text<a href=\"inside\">second</a>text</em> <a href=\"after\">third</a></p>\n",

@@ -240,6 +245,7 @@ doTestsInline(t, tests)

} func TestStrikeThrough(t *testing.T) { + t.Parallel() var tests = []string{ "nothing inline\n", "<p>nothing inline</p>\n",

@@ -269,6 +275,7 @@ doTestsInline(t, tests)

} func TestCodeSpan(t *testing.T) { + t.Parallel() var tests = []string{ "`source code`\n", "<p><code>source code</code></p>\n",

@@ -307,6 +314,7 @@ doTestsInline(t, tests)

} func TestLineBreak(t *testing.T) { + t.Parallel() var tests = []string{ "this line \nhas a break\n", "<p>this line<br />\nhas a break</p>\n",

@@ -346,6 +354,7 @@ extensions: BackslashLineBreak})

} func TestInlineLink(t *testing.T) { + t.Parallel() var tests = []string{ "[foo](/bar/)\n", "<p><a href=\"/bar/\">foo</a></p>\n",

@@ -463,6 +472,7 @@

} func TestRelAttrLink(t *testing.T) { + t.Parallel() var nofollowTests = []string{ "[foo](http://bar.com/foo/)\n", "<p><a href=\"http://bar.com/foo/\" rel=\"nofollow\">foo</a></p>\n",

@@ -521,6 +531,7 @@ })

} func TestHrefTargetBlank(t *testing.T) { + t.Parallel() var tests = []string{ // internal link "[foo](/bar/)\n",

@@ -550,6 +561,7 @@ })

} func TestSafeInlineLink(t *testing.T) { + t.Parallel() var tests = []string{ "[foo](/bar/)\n", "<p><a href=\"/bar/\">foo</a></p>\n",

@@ -583,6 +595,7 @@ doSafeTestsInline(t, tests)

} func TestReferenceLink(t *testing.T) { + t.Parallel() var tests = []string{ "[link][ref]\n", "<p>[link][ref]</p>\n",

@@ -621,6 +634,7 @@ doLinkTestsInline(t, tests)

} func TestTags(t *testing.T) { + t.Parallel() var tests = []string{ "a <span>tag</span>\n", "<p>a <span>tag</span></p>\n",

@@ -638,6 +652,7 @@ doTestsInline(t, tests)

} func TestAutoLink(t *testing.T) { + t.Parallel() var tests = []string{ "http://foo.com/\n", "<p><a href=\"http://foo.com/\">http://foo.com/</a></p>\n",

@@ -943,12 +958,14 @@ "<p>This text does not reference a footnote.</p>\n",

} func TestFootnotes(t *testing.T) { + t.Parallel() doTestsInlineParam(t, footnoteTests, TestParams{ extensions: Footnotes, }) } func TestFootnotesWithParameters(t *testing.T) { + t.Parallel() tests := make([]string, len(footnoteTests)) prefix := "testPrefix"

@@ -978,6 +995,7 @@ })

} func TestNestedFootnotes(t *testing.T) { + t.Parallel() var tests = []string{ `Paragraph.[^fn1]

@@ -1005,6 +1023,7 @@ doTestsInlineParam(t, tests, TestParams{extensions: Footnotes})

} func TestInlineComments(t *testing.T) { + t.Parallel() var tests = []string{ "Hello <!-- there ->\n", "<p>Hello &lt;!&mdash; there &ndash;&gt;</p>\n",

@@ -1034,6 +1053,7 @@ doTestsInlineParam(t, tests, TestParams{HTMLFlags: Smartypants | SmartypantsDashes})

} func TestSmartDoubleQuotes(t *testing.T) { + t.Parallel() var tests = []string{ "this should be normal \"quoted\" text.\n", "<p>this should be normal &ldquo;quoted&rdquo; text.</p>\n",

@@ -1046,6 +1066,7 @@ doTestsInlineParam(t, tests, TestParams{HTMLFlags: Smartypants})

} func TestSmartDoubleQuotesNBSP(t *testing.T) { + t.Parallel() var tests = []string{ "this should be normal \"quoted\" text.\n", "<p>this should be normal &ldquo;&nbsp;quoted&nbsp;&rdquo; text.</p>\n",

@@ -1058,6 +1079,7 @@ doTestsInlineParam(t, tests, TestParams{HTMLFlags: Smartypants | SmartypantsQuotesNBSP})

} func TestSmartAngledDoubleQuotes(t *testing.T) { + t.Parallel() var tests = []string{ "this should be angled \"quoted\" text.\n", "<p>this should be angled &laquo;quoted&raquo; text.</p>\n",

@@ -1070,6 +1092,7 @@ doTestsInlineParam(t, tests, TestParams{HTMLFlags: Smartypants | SmartypantsAngledQuotes})

} func TestSmartAngledDoubleQuotesNBSP(t *testing.T) { + t.Parallel() var tests = []string{ "this should be angled \"quoted\" text.\n", "<p>this should be angled &laquo;&nbsp;quoted&nbsp;&raquo; text.</p>\n",

@@ -1082,6 +1105,7 @@ doTestsInlineParam(t, tests, TestParams{HTMLFlags: Smartypants | SmartypantsAngledQuotes | SmartypantsQuotesNBSP})

} func TestSmartFractions(t *testing.T) { + t.Parallel() var tests = []string{ "1/2, 1/4 and 3/4; 1/4th and 3/4ths\n", "<p>&frac12;, &frac14; and &frac34;; &frac14;th and &frac34;ths</p>\n",

@@ -1100,6 +1124,7 @@ doTestsInlineParam(t, tests, TestParams{HTMLFlags: Smartypants | SmartypantsFractions})

} func TestDisableSmartDashes(t *testing.T) { + t.Parallel() doTestsInlineParam(t, []string{ "foo - bar\n", "<p>foo - bar</p>\n",

@@ -1135,6 +1160,7 @@ }, TestParams{HTMLFlags: Smartypants | SmartypantsLatexDashes})

} func TestSkipLinks(t *testing.T) { + t.Parallel() doTestsInlineParam(t, []string{ "[foo](gopher://foo.bar)", "<p><tt>foo</tt></p>\n",

@@ -1147,6 +1173,7 @@ })

} func TestSkipImages(t *testing.T) { + t.Parallel() doTestsInlineParam(t, []string{ "![foo](/bar/)\n", "<p></p>\n",

@@ -1156,6 +1183,7 @@ })

} func TestUseXHTML(t *testing.T) { + t.Parallel() doTestsParam(t, []string{ "---", "<hr>\n",

@@ -1167,6 +1195,7 @@ }, TestParams{HTMLFlags: UseXHTML})

} func TestSkipHTML(t *testing.T) { + t.Parallel() doTestsParam(t, []string{ "<div class=\"foo\"></div>\n\ntext\n\n<form>the form</form>", "<p>text</p>\n\n<p>the form</p>\n",
M markdown_test.gomarkdown_test.go

@@ -16,6 +16,7 @@

import "testing" func TestDocument(t *testing.T) { + t.Parallel() var tests = []string{ // Empty document. "",
M ref_test.goref_test.go

@@ -20,6 +20,7 @@ "testing"

) func TestReference(t *testing.T) { + t.Parallel() files := []string{ "Amps and angle encoding", "Auto links",

@@ -48,6 +49,7 @@ doTestsReference(t, files, 0)

} func TestReference_EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK(t *testing.T) { + t.Parallel() files := []string{ "Amps and angle encoding", "Auto links",