From 646308596abc3fd896ed699fee08a546c89e0116 Mon Sep 17 00:00:00 2001 From: Cameron Moore Date: Fri, 7 Sep 2018 16:47:14 -0500 Subject: [PATCH] Run tests in parallel (#480) Fixes #475 --- block_test.go | 31 +++++++++++++++++++++++++++++++ esc_test.go | 1 + inline_test.go | 29 +++++++++++++++++++++++++++++ markdown_test.go | 1 + ref_test.go | 2 ++ 5 files changed, 64 insertions(+) diff --git a/block_test.go b/block_test.go index 5cbff6d..326c311 100644 --- a/block_test.go +++ b/block_test.go @@ -19,6 +19,7 @@ import ( ) func TestPrefixHeaderNoExtensions(t *testing.T) { + t.Parallel() var tests = []string{ "# Header 1\n", "

Header 1

\n", @@ -88,6 +89,7 @@ func TestPrefixHeaderNoExtensions(t *testing.T) { } func TestPrefixHeaderSpaceExtension(t *testing.T) { + t.Parallel() var tests = []string{ "# Header 1\n", "

Header 1

\n", @@ -148,6 +150,7 @@ func TestPrefixHeaderSpaceExtension(t *testing.T) { } func TestPrefixHeaderIdExtension(t *testing.T) { + t.Parallel() var tests = []string{ "# Header 1 {#someid}\n", "

Header 1

\n", @@ -208,6 +211,7 @@ func TestPrefixHeaderIdExtension(t *testing.T) { } func TestPrefixHeaderIdExtensionWithPrefixAndSuffix(t *testing.T) { + t.Parallel() var tests = []string{ "# header 1 {#someid}\n", "

header 1

\n", @@ -260,6 +264,7 @@ func TestPrefixHeaderIdExtensionWithPrefixAndSuffix(t *testing.T) { } func TestPrefixAutoHeaderIdExtension(t *testing.T) { + t.Parallel() var tests = []string{ "# Header 1\n", "

Header 1

\n", @@ -311,6 +316,7 @@ func TestPrefixAutoHeaderIdExtension(t *testing.T) { } func TestPrefixAutoHeaderIdExtensionWithPrefixAndSuffix(t *testing.T) { + t.Parallel() var tests = []string{ "# Header 1\n", "

Header 1

\n", @@ -372,6 +378,7 @@ func TestPrefixAutoHeaderIdExtensionWithPrefixAndSuffix(t *testing.T) { } func TestPrefixHeaderLevelOffset(t *testing.T) { + t.Parallel() var offsetTests = []struct { offset int tests []string @@ -458,6 +465,7 @@ func TestPrefixHeaderLevelOffset(t *testing.T) { } func TestPrefixMultipleHeaderExtensions(t *testing.T) { + t.Parallel() var tests = []string{ "# Header\n\n# Header {#header}\n\n# Header 1", "

Header

\n\n

Header

\n\n

Header 1

\n", @@ -466,6 +474,7 @@ func TestPrefixMultipleHeaderExtensions(t *testing.T) { } func TestUnderlineHeaders(t *testing.T) { + t.Parallel() var tests = []string{ "Header 1\n========\n", "

Header 1

\n", @@ -516,6 +525,7 @@ func TestUnderlineHeaders(t *testing.T) { } func TestUnderlineHeadersAutoIDs(t *testing.T) { + t.Parallel() var tests = []string{ "Header 1\n========\n", "

Header 1

\n", @@ -566,6 +576,7 @@ func TestUnderlineHeadersAutoIDs(t *testing.T) { } func TestHorizontalRule(t *testing.T) { + t.Parallel() var tests = []string{ "-\n", "

-

\n", @@ -631,6 +642,7 @@ func TestHorizontalRule(t *testing.T) { } func TestUnorderedList(t *testing.T) { + t.Parallel() var tests = []string{ "* Hello\n", "\n", @@ -742,6 +754,7 @@ func TestUnorderedList(t *testing.T) { } func TestOrderedList(t *testing.T) { + t.Parallel() var tests = []string{ "1. Hello\n", "
    \n
  1. Hello
  2. \n
\n", @@ -838,6 +851,7 @@ func TestOrderedList(t *testing.T) { } func TestDefinitionList(t *testing.T) { + t.Parallel() var tests = []string{ "Term 1\n: Definition a\n", "
\n
Term 1
\n
Definition a
\n
\n", @@ -940,6 +954,7 @@ func TestDefinitionList(t *testing.T) { } func TestConsecutiveLists(t *testing.T) { + t.Parallel() var tests = []string{ "1. Hello\n\n* Hello\n\nTerm 1\n: Definition a\n", "
    \n
  1. Hello
  2. \n
\n\n\n\n
\n
Term 1
\n
Definition a
\n
\n", @@ -951,6 +966,7 @@ func TestConsecutiveLists(t *testing.T) { } func TestPreformattedHtml(t *testing.T) { + t.Parallel() var tests = []string{ "
\n", "
\n", @@ -1004,6 +1020,7 @@ func TestPreformattedHtml(t *testing.T) { } func TestPreformattedHtmlLax(t *testing.T) { + t.Parallel() var tests = []string{ "Paragraph\n
\nHere? >&<\n
\n", "

Paragraph

\n\n
\nHere? >&<\n
\n", @@ -1027,6 +1044,7 @@ func TestPreformattedHtmlLax(t *testing.T) { } func TestFencedCodeBlock(t *testing.T) { + t.Parallel() var tests = []string{ "``` go\nfunc foo() bool {\n\treturn true;\n}\n```\n", "
func foo() bool {\n\treturn true;\n}\n
\n", @@ -1122,6 +1140,7 @@ func TestFencedCodeBlock(t *testing.T) { } 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 @@ okay } func TestTable(t *testing.T) { + t.Parallel() var tests = []string{ "a | b\n---|---\nc | d\n", "\n\n\n\n\n\n\n\n" + @@ -1281,6 +1301,7 @@ func TestTable(t *testing.T) { } func TestUnorderedListWith_EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK(t *testing.T) { + t.Parallel() var tests = []string{ "* Hello\n", "\n", @@ -1392,6 +1413,7 @@ func TestUnorderedListWith_EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK(t *testing.T) { } func TestOrderedList_EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK(t *testing.T) { + t.Parallel() var tests = []string{ "1. Hello\n", "
    \n
  1. Hello
  2. \n
\n", @@ -1488,6 +1510,7 @@ func TestOrderedList_EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK(t *testing.T) { } 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", "
func foo() bool {\n\treturn true;\n}\n
\n", @@ -1562,6 +1585,7 @@ func TestFencedCodeBlock_EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK(t *testing.T) { } func TestListWithFencedCodeBlock(t *testing.T) { + t.Parallel() var tests = []string{ "1. one\n\n ```\n code\n ```\n\n2. two\n", "
    \n
  1. one

    \n\n
    code\n
  2. \n\n
  3. two

  4. \n
\n", @@ -1573,6 +1597,7 @@ func TestListWithFencedCodeBlock(t *testing.T) { } 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 @@ func TestListWithMalformedFencedCodeBlock(t *testing.T) { } 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 @@ func TestListWithFencedCodeBlockNoExtensions(t *testing.T) { } func TestTitleBlock_EXTENSION_TITLEBLOCK(t *testing.T) { + t.Parallel() var tests = []string{ "% Some title\n" + "% Another title line\n" + @@ -1614,6 +1641,7 @@ func TestTitleBlock_EXTENSION_TITLEBLOCK(t *testing.T) { } func TestBlockComments(t *testing.T) { + t.Parallel() var tests = []string{ "Some text\n\n\n", "

Some text

\n\n\n", @@ -1628,6 +1656,7 @@ func TestBlockComments(t *testing.T) { } func TestTOC(t *testing.T) { + t.Parallel() var tests = []string{ "# Title\n\n##Subtitle1\n\n##Subtitle2", //"\n\n

Title

\n\n

Subtitle1

\n\n

Subtitle2

\n", @@ -1748,6 +1777,7 @@ func TestTOC(t *testing.T) { } func TestCompletePage(t *testing.T) { + t.Parallel() var tests = []string{ "*foo*", ` @@ -1769,6 +1799,7 @@ func TestCompletePage(t *testing.T) { } func TestIsFenceLine(t *testing.T) { + t.Parallel() tests := []struct { data []byte infoRequested bool diff --git a/esc_test.go b/esc_test.go index ff67d54..fe318f7 100644 --- a/esc_test.go +++ b/esc_test.go @@ -6,6 +6,7 @@ import ( ) func TestEsc(t *testing.T) { + t.Parallel() tests := []string{ "abc", "abc", "a&c", "a&c", diff --git a/inline_test.go b/inline_test.go index 69b70ae..5a91d8a 100644 --- a/inline_test.go +++ b/inline_test.go @@ -21,6 +21,7 @@ import ( ) func TestEmphasis(t *testing.T) { + t.Parallel() var tests = []string{ "nothing inline\n", "

nothing inline

\n", @@ -77,6 +78,7 @@ func TestEmphasis(t *testing.T) { } func TestReferenceOverride(t *testing.T) { + t.Parallel() var tests = []string{ "test [ref1][]\n", "

test ref1

\n", @@ -135,6 +137,7 @@ func TestReferenceOverride(t *testing.T) { } func TestStrong(t *testing.T) { + t.Parallel() var tests = []string{ "nothing inline\n", "

nothing inline

\n", @@ -194,6 +197,7 @@ func TestStrong(t *testing.T) { } func TestEmphasisMix(t *testing.T) { + t.Parallel() var tests = []string{ "***triple emphasis***\n", "

triple emphasis

\n", @@ -223,6 +227,7 @@ func TestEmphasisMix(t *testing.T) { } func TestEmphasisLink(t *testing.T) { + t.Parallel() var tests = []string{ "[first](before) *text[second] (inside)text* [third](after)\n", "

first textsecondtext third

\n", @@ -240,6 +245,7 @@ func TestEmphasisLink(t *testing.T) { } func TestStrikeThrough(t *testing.T) { + t.Parallel() var tests = []string{ "nothing inline\n", "

nothing inline

\n", @@ -269,6 +275,7 @@ func TestStrikeThrough(t *testing.T) { } func TestCodeSpan(t *testing.T) { + t.Parallel() var tests = []string{ "`source code`\n", "

source code

\n", @@ -307,6 +314,7 @@ func TestCodeSpan(t *testing.T) { } func TestLineBreak(t *testing.T) { + t.Parallel() var tests = []string{ "this line \nhas a break\n", "

this line
\nhas a break

\n", @@ -346,6 +354,7 @@ func TestLineBreak(t *testing.T) { } func TestInlineLink(t *testing.T) { + t.Parallel() var tests = []string{ "[foo](/bar/)\n", "

foo

\n", @@ -463,6 +472,7 @@ func TestInlineLink(t *testing.T) { } func TestRelAttrLink(t *testing.T) { + t.Parallel() var nofollowTests = []string{ "[foo](http://bar.com/foo/)\n", "

foo

\n", @@ -521,6 +531,7 @@ func TestRelAttrLink(t *testing.T) { } func TestHrefTargetBlank(t *testing.T) { + t.Parallel() var tests = []string{ // internal link "[foo](/bar/)\n", @@ -550,6 +561,7 @@ func TestHrefTargetBlank(t *testing.T) { } func TestSafeInlineLink(t *testing.T) { + t.Parallel() var tests = []string{ "[foo](/bar/)\n", "

foo

\n", @@ -583,6 +595,7 @@ func TestSafeInlineLink(t *testing.T) { } func TestReferenceLink(t *testing.T) { + t.Parallel() var tests = []string{ "[link][ref]\n", "

[link][ref]

\n", @@ -621,6 +634,7 @@ func TestReferenceLink(t *testing.T) { } func TestTags(t *testing.T) { + t.Parallel() var tests = []string{ "a tag\n", "

a tag

\n", @@ -638,6 +652,7 @@ func TestTags(t *testing.T) { } func TestAutoLink(t *testing.T) { + t.Parallel() var tests = []string{ "http://foo.com/\n", "

http://foo.com/

\n", @@ -943,12 +958,14 @@ what happens here } 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 TestFootnotesWithParameters(t *testing.T) { } func TestNestedFootnotes(t *testing.T) { + t.Parallel() var tests = []string{ `Paragraph.[^fn1] @@ -1005,6 +1023,7 @@ func TestNestedFootnotes(t *testing.T) { } func TestInlineComments(t *testing.T) { + t.Parallel() var tests = []string{ "Hello
ab