all repos — grayfriday @ f1fd3a64128fa27285fccb2228f7e5db3c8a65d6

blackfriday fork with a few changes

Do away with doTestsInlineParam

What used to be doTestsBlockWithRunner is now renamed to
doTestsWithRunner and is good for both block and inline tests.
Vytautas Ĺ altenis vytas@rtfb.lt
Mon, 04 Apr 2016 12:18:06 +0300
commit

f1fd3a64128fa27285fccb2228f7e5db3c8a65d6

parent

0c7120d6dcf886a1ab1b96a8eab9a7142aebd4e2

1 files changed, 5 insertions(+), 28 deletions(-)

jump to
M test_helpers.gotest_helpers.go

@@ -43,6 +43,10 @@ }, runMarkdownBlock)

} 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 var candidate string defer func() {

@@ -118,34 +122,7 @@ })

} func doTestsInlineParam(t *testing.T, tests []string, params TestParams) { - // catch and report panics - 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) - } - } - } - } + doTestsWithRunner(t, tests, params, runMarkdownInline) } func transformLinks(tests []string, prefix string) []string {