diff --git a/base_test.go b/base_test.go index 53c13c8..b769331 100644 --- a/base_test.go +++ b/base_test.go @@ -17,7 +17,7 @@ type Test struct { } func launchTests(t *testing.T, tests []Test) { - // @todo Check why this fails + // NOTE: TestMustache() makes Parallel testing fail // t.Parallel() for _, test := range tests { @@ -84,6 +84,8 @@ func launchTests(t *testing.T, tests []Test) { } func launchErrorTests(t *testing.T, tests []Test) { + t.Parallel() + for _, test := range tests { var err error var tpl *Template diff --git a/eval_test.go b/eval_test.go index a123e21..b7bd82e 100644 --- a/eval_test.go +++ b/eval_test.go @@ -77,6 +77,8 @@ var evalTests = []Test{ } func TestEval(t *testing.T) { + t.Parallel() + launchTests(t, evalTests) } @@ -109,6 +111,8 @@ func TestEvalErrors(t *testing.T) { } func TestEvalStruct(t *testing.T) { + t.Parallel() + source := `

By {{author.FirstName}} {{Author.lastName}}

{{Body}}
@@ -172,6 +176,8 @@ func (t *TestFoo) Subject() string { } func TestEvalMethod(t *testing.T) { + t.Parallel() + source := `Subject is {{subject}}! YES I SAID {{Subject}}!` expected := `Subject is foo! YES I SAID foo!` @@ -195,6 +201,8 @@ func testBar() string { } func TestEvalMethodReturningFunc(t *testing.T) { + t.Parallel() + source := `Subject is {{subject}}! YES I SAID {{Subject}}!` expected := `Subject is bar! YES I SAID bar!` diff --git a/handlebars/base_test.go b/handlebars/base_test.go index b2431a7..777e5b6 100644 --- a/handlebars/base_test.go +++ b/handlebars/base_test.go @@ -26,8 +26,7 @@ type Test struct { } func launchTests(t *testing.T, tests []Test) { - // @todo Check why this fails - // t.Parallel() + t.Parallel() for _, test := range tests { var err error diff --git a/handlebars/basic_test.go b/handlebars/basic_test.go index 7c6ef41..084b06f 100644 --- a/handlebars/basic_test.go +++ b/handlebars/basic_test.go @@ -620,6 +620,8 @@ func TestBasic(t *testing.T) { } func TestBasicErrors(t *testing.T) { + t.Parallel() + var err error inputs := []string{ diff --git a/helper_test.go b/helper_test.go index c9a51b7..ccfab9b 100644 --- a/helper_test.go +++ b/helper_test.go @@ -159,5 +159,7 @@ var helperTests = []Test{ // func TestHelper(t *testing.T) { + t.Parallel() + launchTests(t, helperTests) } diff --git a/lexer/lexer_test.go b/lexer/lexer_test.go index 035a85e..71e8bf0 100644 --- a/lexer/lexer_test.go +++ b/lexer/lexer_test.go @@ -504,6 +504,8 @@ func equal(i1, i2 []Token, checkPos bool) bool { } func TestLexer(t *testing.T) { + t.Parallel() + for _, test := range lexTests { tokens := collect(&test) if !equal(tokens, test.tokens, false) { diff --git a/mustache_test.go b/mustache_test.go index 4d660a5..cae066f 100644 --- a/mustache_test.go +++ b/mustache_test.go @@ -228,5 +228,7 @@ var mustacheLambdasTests = []Test{ } func TestMustacheLambdas(t *testing.T) { + t.Parallel() + launchTests(t, mustacheLambdasTests) } diff --git a/parser/parser_test.go b/parser/parser_test.go index bb9ca89..0baafbc 100644 --- a/parser/parser_test.go +++ b/parser/parser_test.go @@ -85,6 +85,8 @@ var parserTests = []parserTest{ } func TestParser(t *testing.T) { + t.Parallel() + for _, test := range parserTests { output := "" @@ -156,6 +158,8 @@ var parserErrorTests = []parserTest{ } func TestParserErrors(t *testing.T) { + t.Parallel() + for _, test := range parserErrorTests { node, err := Parse(test.input) if err == nil { diff --git a/string_test.go b/string_test.go index d056a17..eaec630 100644 --- a/string_test.go +++ b/string_test.go @@ -24,6 +24,8 @@ var strTests = []strTest{ } func TestStr(t *testing.T) { + t.Parallel() + for _, test := range strTests { if res := Str(test.input); res != test.output { t.Errorf("Failed to stringify: %s\nexpected:\n\t'%s'got:\n\t%q", test.name, test.output, res) diff --git a/template_test.go b/template_test.go index f596342..c194b28 100644 --- a/template_test.go +++ b/template_test.go @@ -25,6 +25,8 @@ CONTENT[ ' ` func TestNewTemplate(t *testing.T) { + t.Parallel() + tpl := newTemplate(sourceBasic) if tpl.source != sourceBasic { t.Errorf("Failed to instantiate template") @@ -32,6 +34,8 @@ func TestNewTemplate(t *testing.T) { } func TestParse(t *testing.T) { + t.Parallel() + tpl, err := Parse(sourceBasic) if err != nil || (tpl.source != sourceBasic) { t.Errorf("Failed to parse template") @@ -43,6 +47,8 @@ func TestParse(t *testing.T) { } func TestClone(t *testing.T) { + t.Parallel() + sourcePartial := `I am a {{wat}} partial` sourcePartial2 := `Partial for the {{wat}}`