Help us shape the future of Go! Take the 2026 Go Developer Survey

testutil

package
v1.8.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package testutil provides utilities for unit tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DiffPretty added in v1.3.6

func DiffPretty(v1, v2 []byte) []byte

DiffPretty returns pretty formatted diff between given bytes.

func DoTestCase

func DoTestCase(m goldmark.Markdown, testCase MarkdownTestCase, t TestingT, opts ...parser.ParseOption)

DoTestCase runs a test case.

func DoTestCaseFile

func DoTestCaseFile(m goldmark.Markdown, filename string, t TestingT, no ...int)

DoTestCaseFile runs test cases in a given file.

func DoTestCases

func DoTestCases(m goldmark.Markdown, cases []MarkdownTestCase, t TestingT, opts ...parser.ParseOption)

DoTestCases runs a set of test cases.

func ParseCliCaseArg added in v1.1.33

func ParseCliCaseArg() []int

ParseCliCaseArg parses -case command line args.

Types

type MarkdownTestCase

type MarkdownTestCase struct {
	No          int
	Description string
	Options     MarkdownTestCaseOptions
	Markdown    string
	Expected    string
}

MarkdownTestCase represents a test case.

type MarkdownTestCaseOptions added in v1.4.1

type MarkdownTestCaseOptions struct {
	EnableEscape bool
	Trim         bool
}

MarkdownTestCaseOptions represents options for each test case.

type TestingT

type TestingT interface {
	Logf(string, ...any)
	Skipf(string, ...any)
	Errorf(string, ...any)
	FailNow()
}

TestingT is a subset of the functionality provided by testing.T.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL