testsupport

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2022 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var IncludeStdOut = func(t *ConsoleOutput) {
	t.out = os.Stdout
}

Functions

func ContainAnyMessageWithLevels

func ContainAnyMessageWithLevels(level log.Level, otherLevels ...log.Level) types.GomegaMatcher

ContainAnyMessageWithLevels a custom Matcher to verify that no message with the any of the given levels was logged

func ContainJSONLog added in v0.7.0

func ContainJSONLog(level log.Level, msg string) types.GomegaMatcher

ContainJSONLog a custom Matcher to verify that a message at a given level was logged

func ContainJSONLogWithOffset added in v0.7.0

func ContainJSONLogWithOffset(level log.Level, startOffset int, endOffset int, msg string) types.GomegaMatcher

ContainJSONLogWithOffset a custom Matcher to verify that a message with offset position and at a given level was logged

func MatchDocument added in v0.4.0

func MatchDocument(expected *types.Document) gomegatypes.GomegaMatcher

MatchDocument a custom matcher to verify that a document matches the given expectation Similar to the standard `Equal` matcher, but display a diff when the values don't match

func MatchDocumentFragment added in v0.7.0

func MatchDocumentFragment(expected types.DocumentFragment) gomegatypes.GomegaMatcher

MatchDocumentFragment a custom matcher to verify that a document matches the given expectation Similar to the standard `Equal` matcher, but display a diff when the values don't match

func MatchDocumentFragments added in v0.7.0

func MatchDocumentFragments(expected []types.DocumentFragment) gomegatypes.GomegaMatcher

MatchDocumentFragments a custom matcher to verify that a document matches the given expectation Similar to the standard `Equal` matcher, but display a diff when the values don't match

func MatchHTML added in v0.4.0

func MatchHTML(expected string) gomegatypes.GomegaMatcher

MatchHTML a custom matcher to verify that a document renders as the given template which will be processed with the given args

func MatchHTMLFromFile added in v0.7.0

func MatchHTMLFromFile(filename string) gomegatypes.GomegaMatcher

MatchHTMLFromFile a custom matcher to verify that a document renders as the content of the file with the given name

func MatchHTMLTemplate added in v0.4.0

func MatchHTMLTemplate(expectedTmpl string, data interface{}) gomegatypes.GomegaMatcher

MatchHTMLTemplate a custom matcher to verify that a document renders as the given template which will be processed with the given args

func MatchHTMLTemplateFile added in v0.7.0

func MatchHTMLTemplateFile(filename string, data interface{}) gomegatypes.GomegaMatcher

MatchHTMLTemplate a custom matcher to verify that a document renders as the given template which will be processed with the given args

func MatchInlineElements added in v0.5.0

func MatchInlineElements(expected []interface{}) gomegatypes.GomegaMatcher

MatchInlineElements a custom matcher to verify that a document matches the given expectation Similar to the standard `Equal` matcher, but display a diff when the values don't match

func MatchMetadata added in v0.7.0

func MatchMetadata(expected types.Metadata) gomegatypes.GomegaMatcher

func MatchTableOfContents added in v0.7.0

func MatchTableOfContents(expected *types.TableOfContents) gomegatypes.GomegaMatcher

MatchTableOfContents a custom matcher to verify that a TableOfContents matches the given expectation Similar to the standard `Equal` matcher, but display a diff when the values don't match

func ParseDocument

func ParseDocument(actual string, options ...interface{}) (*types.Document, error)

ParseDocument parses the actual value into a Document

func ParseDocumentFragments added in v0.7.0

func ParseDocumentFragments(actual string, options ...parser.Option) ([]types.DocumentFragment, error)

ParseDocumentFragments parses the actual source with the options

func PreparseDocument added in v0.7.0

func PreparseDocument(source string, options ...interface{}) (string, error)

func RenderHTML added in v0.4.0

func RenderHTML(actual string, settings ...configuration.Setting) (string, error)

RenderHTML renders the HTML body using the given source

func RenderHTMLFromFile added in v0.7.0

func RenderHTMLFromFile(filename string, settings ...configuration.Setting) (string, types.Metadata, error)

RenderHTML renders the HTML body using the given source

func RenderHTMLWithMetadata added in v0.7.0

func RenderHTMLWithMetadata(actual string, settings ...configuration.Setting) (string, types.Metadata, error)

RenderHTML renders the HTML body using the given source

Types

type Console added in v0.7.0

type Console interface {
	Content() io.Reader
}

type ConsoleOutput added in v0.7.0

type ConsoleOutput struct {
	// contains filtered or unexported fields
}

func ConfigureLogger

func ConfigureLogger(level log.Level, opts ...TeeOption) (*ConsoleOutput, func())

func NewConsoleOutput added in v0.7.0

func NewConsoleOutput() *ConsoleOutput

func (ConsoleOutput) Content added in v0.7.0

func (t ConsoleOutput) Content() io.Reader

func (*ConsoleOutput) Write added in v0.7.0

func (t *ConsoleOutput) Write(p []byte) (n int, err error)

type TeeOption added in v0.7.0

type TeeOption func(*ConsoleOutput)

Jump to

Keyboard shortcuts

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