all repos — grayfriday @ 90509d39d42dcfcdad9e529c8a2745d3bbc2938b

blackfriday fork with a few changes

Make a way to parameterize inline tests

Expose extensions and html flags parameters so that tests could specify
what code paths they want to exercise.
Vytautas Ĺ altenis Vytautas.Shaltenis@gmail.com
Sat, 13 Apr 2013 22:18:14 +0300
commit

90509d39d42dcfcdad9e529c8a2745d3bbc2938b

parent

3c0965e698ef648c6bcd7284eaea0f64337e4536

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

jump to
M inline_test.goinline_test.go

@@ -17,12 +17,10 @@ import (

"testing" ) -func runMarkdownInline(input string) string { - extensions := 0 +func runMarkdownInline(input string, extensions, htmlFlags int) string { extensions |= EXTENSION_AUTOLINK extensions |= EXTENSION_STRIKETHROUGH - htmlFlags := 0 htmlFlags |= HTML_USE_XHTML renderer := HtmlRenderer(htmlFlags, "", "")

@@ -31,6 +29,10 @@ return string(Markdown([]byte(input), renderer, extensions))

} func doTestsInline(t *testing.T, tests []string) { + doTestsInlineParam(t, tests, 0, 0) +} + +func doTestsInlineParam(t *testing.T, tests []string, extensions, htmlFlags int) { // catch and report panics var candidate string defer func() {

@@ -43,7 +45,7 @@ for i := 0; i+1 < len(tests); i += 2 {

input := tests[i] candidate = input expected := tests[i+1] - actual := runMarkdownInline(candidate) + actual := runMarkdownInline(candidate, extensions, htmlFlags) if actual != expected { t.Errorf("\nInput [%#v]\nExpected[%#v]\nActual [%#v]", candidate, expected, actual)

@@ -54,7 +56,7 @@ if !testing.Short() {

for start := 0; start < len(input); start++ { for end := start + 1; end <= len(input); end++ { candidate = input[start:end] - _ = runMarkdownInline(candidate) + _ = runMarkdownInline(candidate, extensions, htmlFlags) } } }