Skip to content

Commit

Permalink
Run tests in parallel (#480)
Browse files Browse the repository at this point in the history
Fixes #475
  • Loading branch information
moorereason authored and rtfb committed Sep 7, 2018
1 parent 2ab1ea3 commit 6463085
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 0 deletions.
31 changes: 31 additions & 0 deletions block_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
)

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

func TestPrefixHeaderSpaceExtension(t *testing.T) {
t.Parallel()
var tests = []string{
"# Header 1\n",
"<h1>Header 1</h1>\n",
Expand Down Expand Up @@ -148,6 +150,7 @@ func TestPrefixHeaderSpaceExtension(t *testing.T) {
}

func TestPrefixHeaderIdExtension(t *testing.T) {
t.Parallel()
var tests = []string{
"# Header 1 {#someid}\n",
"<h1 id=\"someid\">Header 1</h1>\n",
Expand Down Expand Up @@ -208,6 +211,7 @@ func TestPrefixHeaderIdExtension(t *testing.T) {
}

func TestPrefixHeaderIdExtensionWithPrefixAndSuffix(t *testing.T) {
t.Parallel()
var tests = []string{
"# header 1 {#someid}\n",
"<h1 id=\"PRE:someid:POST\">header 1</h1>\n",
Expand Down Expand Up @@ -260,6 +264,7 @@ func TestPrefixHeaderIdExtensionWithPrefixAndSuffix(t *testing.T) {
}

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

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

func TestPrefixHeaderLevelOffset(t *testing.T) {
t.Parallel()
var offsetTests = []struct {
offset int
tests []string
Expand Down Expand Up @@ -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",
"<h1 id=\"header\">Header</h1>\n\n<h1 id=\"header-1\">Header</h1>\n\n<h1 id=\"header-1-1\">Header 1</h1>\n",
Expand All @@ -466,6 +474,7 @@ func TestPrefixMultipleHeaderExtensions(t *testing.T) {
}

func TestUnderlineHeaders(t *testing.T) {
t.Parallel()
var tests = []string{
"Header 1\n========\n",
"<h1>Header 1</h1>\n",
Expand Down Expand Up @@ -516,6 +525,7 @@ func TestUnderlineHeaders(t *testing.T) {
}

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

func TestHorizontalRule(t *testing.T) {
t.Parallel()
var tests = []string{
"-\n",
"<p>-</p>\n",
Expand Down Expand Up @@ -631,6 +642,7 @@ func TestHorizontalRule(t *testing.T) {
}

func TestUnorderedList(t *testing.T) {
t.Parallel()
var tests = []string{
"* Hello\n",
"<ul>\n<li>Hello</li>\n</ul>\n",
Expand Down Expand Up @@ -742,6 +754,7 @@ func TestUnorderedList(t *testing.T) {
}

func TestOrderedList(t *testing.T) {
t.Parallel()
var tests = []string{
"1. Hello\n",
"<ol>\n<li>Hello</li>\n</ol>\n",
Expand Down Expand Up @@ -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",
"<dl>\n<dt>Term 1</dt>\n<dd>Definition a</dd>\n</dl>\n",
Expand Down Expand Up @@ -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",
"<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",
Expand All @@ -951,6 +966,7 @@ func TestConsecutiveLists(t *testing.T) {
}

func TestPreformattedHtml(t *testing.T) {
t.Parallel()
var tests = []string{
"<div></div>\n",
"<div></div>\n",
Expand Down Expand Up @@ -1004,6 +1020,7 @@ func TestPreformattedHtml(t *testing.T) {
}

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",
Expand All @@ -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",
"<pre><code class=\"language-go\">func foo() bool {\n\treturn true;\n}\n</code></pre>\n",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -1234,6 +1253,7 @@ okay
}

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" +
Expand Down Expand Up @@ -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",
"<ul>\n<li>Hello</li>\n</ul>\n",
Expand Down Expand Up @@ -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",
"<ol>\n<li>Hello</li>\n</ol>\n",
Expand Down Expand Up @@ -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",
"<pre><code class=\"language-go\">func foo() bool {\n\treturn true;\n}\n</code></pre>\n",
Expand Down Expand Up @@ -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",
"<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",
Expand All @@ -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.
Expand All @@ -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{
Expand All @@ -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" +
Expand All @@ -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<!-- comment -->\n",
"<p>Some text</p>\n\n<!-- comment -->\n",
Expand All @@ -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",
//"<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",
Expand Down Expand Up @@ -1748,6 +1777,7 @@ func TestTOC(t *testing.T) {
}

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">
Expand All @@ -1769,6 +1799,7 @@ func TestCompletePage(t *testing.T) {
}

func TestIsFenceLine(t *testing.T) {
t.Parallel()
tests := []struct {
data []byte
infoRequested bool
Expand Down
1 change: 1 addition & 0 deletions esc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
)

func TestEsc(t *testing.T) {
t.Parallel()
tests := []string{
"abc", "abc",
"a&c", "a&amp;c",
Expand Down
Loading

0 comments on commit 6463085

Please sign in to comment.