testutil

package
v1.1.33-0...-16f4919 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertEqualBytes

func AssertEqualBytes(t *testing.T, a, b []byte) bool

AssertEqualBytes asserts that the two input byte slices have the same length and contents.

func AssertSameStructure

func AssertSameStructure(t *testing.T, sourceA, sourceB []byte, a, b ast.Node, assertions NodeAssertions) bool

AssertSameStructure walks the ASTs rooted at a and b

func DoTestCase

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

DoTestCase runs a test case.

func DoTestCaseFile

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

DoTestCaseFile runs test cases in a given file.

func DoTestCases

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

DoTestCases runs a set of test cases.

Types

type AssertNodeFunc

type AssertNodeFunc func(t *testing.T, sourceA, sourceB []byte, a, b ast.Node) bool

AssertNodeFunc is used by AssertSameStructure to assert that two nodes are semantically identical.

type MarkdownTestCase

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

MarkdownTestCase represents a test case.

type NodeAssertions

type NodeAssertions map[ast.NodeKind]AssertNodeFunc

NodeAssertions maps from node kinds to AssertNodeFunc.

func DefaultNodeAssertions

func DefaultNodeAssertions() NodeAssertions

DefaultNodeAssertions returns the default set of node assertions.

func (NodeAssertions) Union

Union returns a new set of node assertions that is the union of the two input sets.

type TestingT

type TestingT interface {
	Logf(string, ...interface{})
	Skipf(string, ...interface{})
	Errorf(string, ...interface{})
	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