mirror of
https://github.com/yuin/goldmark
synced 2025-03-04 23:04:52 +00:00
This moves the following functions meant for use from tests into a
testutil subpackage.
func DoTestCase(m Markdown, testCase MarkdownTestCase, t TestingT)
func DoTestCaseFile(m Markdown, filename string, t TestingT)
func DoTestCases(m goldmark.Markdown, cases []MarkdownTestCase, t TestingT)
This will help keep the top-level goldmark package clean and limited to
core functionality.
(Note that tests in the top-level goldmark package that make use of
these functions must now use the package name `goldmark_test` so that
they're considered separate from the main `goldmark` package, otherwise
you'll see an import cycle: goldmark imports testutil imports goldmark.)
21 lines
377 B
Go
21 lines
377 B
Go
package extension
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/yuin/goldmark"
|
|
"github.com/yuin/goldmark/testutil"
|
|
"github.com/yuin/goldmark/renderer/html"
|
|
)
|
|
|
|
func TestLinkify(t *testing.T) {
|
|
markdown := goldmark.New(
|
|
goldmark.WithRendererOptions(
|
|
html.WithUnsafe(),
|
|
),
|
|
goldmark.WithExtensions(
|
|
Linkify,
|
|
),
|
|
)
|
|
testutil.DoTestCaseFile(markdown, "_test/linkify.txt", t)
|
|
}
|