ztest

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2024 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Diff

func Diff(have, want string, opt ...DiffOpt) string

Diff two strings and format as a unified diff.

func DiffMatch

func DiffMatch(have, want string, opt ...DiffOpt) string

DiffMatch formats a unified diff, but accepts various patterns in the want string:

%(YEAR)      current year in UTC
%(MONTH)     current month in UTC
%(DAY)       current day in UTC
%(UUID)      UUID format (any version).

%(ANY)       any text: .+?
%(ANY 5)     any text of exactly 5 characters: .{5}?
%(ANY 5,)    any text of at least 5 characters: .{5,}?
%(ANY 5,10)  any text between 5 and 10 characters: .{5,10}?
%(ANY 10)    any text at most 10 characters: .{,10}?
%(NUMBER)    any number; also allows length like ANY.

%(..)        any regular expression, but \ is not allowed.

Types

type DiffOpt

type DiffOpt int
const (
	// Normalize whitespace: remove all whitespace at the start and end of every
	// line.
	DiffNormalizeWhitespace DiffOpt = iota + 1

	// Treat arguments as JSON: format them before diffing.
	DiffJSON
)

Jump to

Keyboard shortcuts

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