difftest

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package difftest implement test based on diffing serialized string output

User provides a function that get a input path and input string and returns a output path and output string. Content of output path and output string is compared and if there is a difference the test fails with a diff.

Test inputs are read from files matching Pattern from Path.

Note that output path can be the same as input which useful if the function implements some kind of transcript that includes both input and output.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Error

func Error(t tf, expected string, actual string)

func ErrorEx

func ErrorEx(t tf, color bool, expected string, actual string)

func Fatal

func Fatal(t tf, expected string, actual string)

func FatalEx

func FatalEx(t tf, color bool, expected string, actual string)

func Test

func Test(t *testing.T, pattern string, fn Fn)

func TestWithOptions

func TestWithOptions(t *testing.T, opts Options)

Types

type Fn

type Fn func(t *testing.T, path string, input string) (string, string, error)

type Options

type Options struct {
	Path        string
	Pattern     string
	ColorDiff   bool
	WriteOutput bool
	Fn          Fn
}

Jump to

Keyboard shortcuts

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