Do away with doTestsInlineParam

What used to be doTestsBlockWithRunner is now renamed to
doTestsWithRunner and is good for both block and inline tests.
This commit is contained in:
Vytautas Šaltenis 2016-04-04 12:18:06 +03:00
parent 0c7120d6dc
commit f1fd3a6412

View File

@ -43,6 +43,10 @@ func doTestsBlock(t *testing.T, tests []string, extensions Extensions) {
} }
func doTestsBlockWithRunner(t *testing.T, tests []string, params TestParams, runner func(string, TestParams) string) { func doTestsBlockWithRunner(t *testing.T, tests []string, params TestParams, runner func(string, TestParams) string) {
doTestsWithRunner(t, tests, params, runner)
}
func doTestsWithRunner(t *testing.T, tests []string, params TestParams, runner func(string, TestParams) string) {
// catch and report panics // catch and report panics
var candidate string var candidate string
defer func() { defer func() {
@ -118,34 +122,7 @@ func doSafeTestsInline(t *testing.T, tests []string) {
} }
func doTestsInlineParam(t *testing.T, tests []string, params TestParams) { func doTestsInlineParam(t *testing.T, tests []string, params TestParams) {
// catch and report panics doTestsWithRunner(t, tests, params, runMarkdownInline)
var candidate string
defer func() {
if err := recover(); err != nil {
t.Errorf("\npanic while processing [%#v] (%v)\n", candidate, err)
}
}()
for i := 0; i+1 < len(tests); i += 2 {
input := tests[i]
candidate = input
expected := tests[i+1]
actual := runMarkdownInline(candidate, params)
if actual != expected {
t.Errorf("\nInput [%#v]\nExpected[%#v]\nActual [%#v]",
candidate, expected, actual)
}
// now test every substring to stress test bounds checking
if !testing.Short() {
for start := 0; start < len(input); start++ {
for end := start + 1; end <= len(input); end++ {
candidate = input[start:end]
runMarkdownInline(candidate, params)
}
}
}
}
} }
func transformLinks(tests []string, prefix string) []string { func transformLinks(tests []string, prefix string) []string {