assert

package module
v0.0.0-...-033a8a9 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2018 License: MIT Imports: 18 Imported by: 2

README

Golang assert library

How to use

  package yours

  import (
    "testing"
    "github.com/govenue/assert"
  )

  func TestSomething(t *testing.T) {

    // assert equality
    assert.Equal(t, 123, 123, "they should be equal")

    // assert inequality
    assert.NotEqual(t, 123, 456, "they should not be equal")

    // assert for nil (good for errors)
    assert.Nil(t, object)

    // assert for not nil (good when you expect something)
    if assert.NotNil(t, object) {

      // now we know that object isn't nil, we are safe to make
      // further assertions without causing any errors
      assert.Equal(t, "Something", object.Value)

    }

  }

if you assert many times, use the below:

  package yours

  import (
    "testing"
    "github.com/govenue/assert"
  )

  func TestSomething(t *testing.T) {
    assert := assert.New(t)

    // assert equality
    assert.Equal(123, 123, "they should be equal")

    // assert inequality
    assert.NotEqual(123, 456, "they should not be equal")

    // assert for nil (good for errors)
    assert.Nil(object)

    // assert for not nil (good when you expect something)
    if assert.NotNil(object) {

      // now we know that object isn't nil, we are safe to make
      // further assertions without causing any errors
      assert.Equal("Something", object.Value)
    }
  }

License

Base on testify/assert, Thanks stretchr.

Documentation

Overview

Package assert provides a set of comprehensive testing tools for use with the normal Go testing system.

Example Usage

The following is a complete example using assert in a standard test function:

import (
  "testing"
  "github.com/stretchr/testify/assert"
)

func TestSomething(t *testing.T) {

  var a string = "Hello"
  var b string = "Hello"

  assert.Equal(t, a, b, "The two words should be the same.")

}

if you assert many times, use the format below:

import (
  "testing"
  "github.com/stretchr/testify/assert"
)

func TestSomething(t *testing.T) {
  assert := assert.New(t)

  var a string = "Hello"
  var b string = "Hello"

  assert.Equal(a, b, "The two words should be the same.")
}

Assertions

Assertions allow you to easily write test code, and are global funcs in the `assert` package. All assertion functions take, as the first argument, the `*testing.T` object provided by the testing framework. This allows the assertion funcs to write the failings and other details to the correct place.

Every assertion function also takes an optional string message as the final argument, allowing custom error messages to be appended to the message the assertion method outputs.

Index

Constants

This section is empty.

Variables

View Source
var AnError = errors.New("assert.AnError general error for testing")

Functions

func CallerInfo

func CallerInfo() []string

func Condition

func Condition(t TestingT, comp Comparison, msgAndArgs ...interface{}) bool

func Conditionf

func Conditionf(t TestingT, comp Comparison, msg string, args ...interface{}) bool

func Contains

func Contains(t TestingT, s, contains interface{}, msgAndArgs ...interface{}) bool

func Containsf

func Containsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) bool

func Empty

func Empty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool

func Emptyf

func Emptyf(t TestingT, object interface{}, msg string, args ...interface{}) bool

func Equal

func Equal(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool

func EqualError

func EqualError(t TestingT, theError error, errString string, msgAndArgs ...interface{}) bool

func EqualErrorf

func EqualErrorf(t TestingT, theError error, errString string, msg string, args ...interface{}) bool

func EqualValues

func EqualValues(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool

func EqualValuesf

func EqualValuesf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool

func Equalf

func Equalf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool

func Error

func Error(t TestingT, err error, msgAndArgs ...interface{}) bool

func Errorf

func Errorf(t TestingT, err error, msg string, args ...interface{}) bool

func Exactly

func Exactly(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool

func Exactlyf

func Exactlyf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool

func Fail

func Fail(t TestingT, failureMessage string, msgAndArgs ...interface{}) bool

func FailNow

func FailNow(t TestingT, failureMessage string, msgAndArgs ...interface{}) bool

func FailNowf

func FailNowf(t TestingT, failureMessage string, msg string, args ...interface{}) bool

func Failf

func Failf(t TestingT, failureMessage string, msg string, args ...interface{}) bool

func False

func False(t TestingT, value bool, msgAndArgs ...interface{}) bool

func Falsef

func Falsef(t TestingT, value bool, msg string, args ...interface{}) bool

func GetContextDiffString

func GetContextDiffString(diff ContextDiff) (string, error)

func GetUnifiedDiffString

func GetUnifiedDiffString(diff UnifiedDiff) (string, error)

func HTTPBody

func HTTPBody(handler http.HandlerFunc, method, url string, values url.Values) string

func HTTPBodyContains

func HTTPBodyContains(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, str interface{}) bool

func HTTPBodyContainsf

func HTTPBodyContainsf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}) bool

func HTTPBodyNotContains

func HTTPBodyNotContains(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, str interface{}) bool

func HTTPBodyNotContainsf

func HTTPBodyNotContainsf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}) bool

func HTTPError

func HTTPError(t TestingT, handler http.HandlerFunc, method, url string, values url.Values) bool

func HTTPErrorf

func HTTPErrorf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values) bool

func HTTPRedirect

func HTTPRedirect(t TestingT, handler http.HandlerFunc, method, url string, values url.Values) bool

func HTTPRedirectf

func HTTPRedirectf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values) bool

func HTTPSuccess

func HTTPSuccess(t TestingT, handler http.HandlerFunc, method, url string, values url.Values) bool

func HTTPSuccessf

func HTTPSuccessf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values) bool

func Implements

func Implements(t TestingT, interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) bool

func Implementsf

func Implementsf(t TestingT, interfaceObject interface{}, object interface{}, msg string, args ...interface{}) bool

func InDelta

func InDelta(t TestingT, expected, actual interface{}, delta float64, msgAndArgs ...interface{}) bool

func InDeltaSlice

func InDeltaSlice(t TestingT, expected, actual interface{}, delta float64, msgAndArgs ...interface{}) bool

func InDeltaSlicef

func InDeltaSlicef(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool

func InDeltaf

func InDeltaf(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool

func InEpsilon

func InEpsilon(t TestingT, expected, actual interface{}, epsilon float64, msgAndArgs ...interface{}) bool

func InEpsilonSlice

func InEpsilonSlice(t TestingT, expected, actual interface{}, epsilon float64, msgAndArgs ...interface{}) bool

func InEpsilonSlicef

func InEpsilonSlicef(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool

func InEpsilonf

func InEpsilonf(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool

func IsType

func IsType(t TestingT, expectedType interface{}, object interface{}, msgAndArgs ...interface{}) bool

func IsTypef

func IsTypef(t TestingT, expectedType interface{}, object interface{}, msg string, args ...interface{}) bool

func JSONEq

func JSONEq(t TestingT, expected string, actual string, msgAndArgs ...interface{}) bool

func JSONEqf

func JSONEqf(t TestingT, expected string, actual string, msg string, args ...interface{}) bool

func Len

func Len(t TestingT, object interface{}, length int, msgAndArgs ...interface{}) bool

func Lenf

func Lenf(t TestingT, object interface{}, length int, msg string, args ...interface{}) bool

func Nil

func Nil(t TestingT, object interface{}, msgAndArgs ...interface{}) bool

func Nilf

func Nilf(t TestingT, object interface{}, msg string, args ...interface{}) bool

func NoError

func NoError(t TestingT, err error, msgAndArgs ...interface{}) bool

func NoErrorf

func NoErrorf(t TestingT, err error, msg string, args ...interface{}) bool

func NotContains

func NotContains(t TestingT, s, contains interface{}, msgAndArgs ...interface{}) bool

func NotContainsf

func NotContainsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) bool

func NotEmpty

func NotEmpty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool

func NotEmptyf

func NotEmptyf(t TestingT, object interface{}, msg string, args ...interface{}) bool

func NotEqual

func NotEqual(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool

func NotEqualf

func NotEqualf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool

func NotNil

func NotNil(t TestingT, object interface{}, msgAndArgs ...interface{}) bool

func NotNilf

func NotNilf(t TestingT, object interface{}, msg string, args ...interface{}) bool

func NotPanics

func NotPanics(t TestingT, f PanicTestFunc, msgAndArgs ...interface{}) bool

func NotPanicsf

func NotPanicsf(t TestingT, f PanicTestFunc, msg string, args ...interface{}) bool

func NotRegexp

func NotRegexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) bool

func NotRegexpf

func NotRegexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) bool

func NotSubset

func NotSubset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) (ok bool)

func NotSubsetf

func NotSubsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) bool

func NotZero

func NotZero(t TestingT, i interface{}, msgAndArgs ...interface{}) bool

func NotZerof

func NotZerof(t TestingT, i interface{}, msg string, args ...interface{}) bool

func ObjectsAreEqual

func ObjectsAreEqual(expected, actual interface{}) bool

func ObjectsAreEqualValues

func ObjectsAreEqualValues(expected, actual interface{}) bool

func Panics

func Panics(t TestingT, f PanicTestFunc, msgAndArgs ...interface{}) bool

func PanicsWithValue

func PanicsWithValue(t TestingT, expected interface{}, f PanicTestFunc, msgAndArgs ...interface{}) bool

func PanicsWithValuef

func PanicsWithValuef(t TestingT, expected interface{}, f PanicTestFunc, msg string, args ...interface{}) bool

func Panicsf

func Panicsf(t TestingT, f PanicTestFunc, msg string, args ...interface{}) bool

func Regexp

func Regexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) bool

func Regexpf

func Regexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) bool

func SplitLines

func SplitLines(s string) []string

func Subset

func Subset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) (ok bool)

func Subsetf

func Subsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) bool

func True

func True(t TestingT, value bool, msgAndArgs ...interface{}) bool

func Truef

func Truef(t TestingT, value bool, msg string, args ...interface{}) bool

func WithinDuration

func WithinDuration(t TestingT, expected, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) bool

func WithinDurationf

func WithinDurationf(t TestingT, expected time.Time, actual time.Time, delta time.Duration, msg string, args ...interface{}) bool

func WriteContextDiff

func WriteContextDiff(writer io.Writer, diff ContextDiff) error

func WriteUnifiedDiff

func WriteUnifiedDiff(writer io.Writer, diff UnifiedDiff) error

func Zero

func Zero(t TestingT, i interface{}, msgAndArgs ...interface{}) bool

func Zerof

func Zerof(t TestingT, i interface{}, msg string, args ...interface{}) bool

Types

type Assertions

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

func New

func New(t TestingT) *Assertions

func (*Assertions) Condition

func (a *Assertions) Condition(comp Comparison, msgAndArgs ...interface{}) bool

func (*Assertions) Conditionf

func (a *Assertions) Conditionf(comp Comparison, msg string, args ...interface{}) bool

func (*Assertions) Contains

func (a *Assertions) Contains(s interface{}, contains interface{}, msgAndArgs ...interface{}) bool

func (*Assertions) Containsf

func (a *Assertions) Containsf(s interface{}, contains interface{}, msg string, args ...interface{}) bool

func (*Assertions) Empty

func (a *Assertions) Empty(object interface{}, msgAndArgs ...interface{}) bool

func (*Assertions) Emptyf

func (a *Assertions) Emptyf(object interface{}, msg string, args ...interface{}) bool

func (*Assertions) Equal

func (a *Assertions) Equal(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool

func (*Assertions) EqualError

func (a *Assertions) EqualError(theError error, errString string, msgAndArgs ...interface{}) bool

func (*Assertions) EqualErrorf

func (a *Assertions) EqualErrorf(theError error, errString string, msg string, args ...interface{}) bool

func (*Assertions) EqualValues

func (a *Assertions) EqualValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool

func (*Assertions) EqualValuesf

func (a *Assertions) EqualValuesf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool

func (*Assertions) Equalf

func (a *Assertions) Equalf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool

func (*Assertions) Error

func (a *Assertions) Error(err error, msgAndArgs ...interface{}) bool

func (*Assertions) Errorf

func (a *Assertions) Errorf(err error, msg string, args ...interface{}) bool

func (*Assertions) Exactly

func (a *Assertions) Exactly(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool

func (*Assertions) Exactlyf

func (a *Assertions) Exactlyf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool

func (*Assertions) Fail

func (a *Assertions) Fail(failureMessage string, msgAndArgs ...interface{}) bool

func (*Assertions) FailNow

func (a *Assertions) FailNow(failureMessage string, msgAndArgs ...interface{}) bool

func (*Assertions) FailNowf

func (a *Assertions) FailNowf(failureMessage string, msg string, args ...interface{}) bool

func (*Assertions) Failf

func (a *Assertions) Failf(failureMessage string, msg string, args ...interface{}) bool

func (*Assertions) False

func (a *Assertions) False(value bool, msgAndArgs ...interface{}) bool

func (*Assertions) Falsef

func (a *Assertions) Falsef(value bool, msg string, args ...interface{}) bool

func (*Assertions) HTTPBodyContains

func (a *Assertions) HTTPBodyContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}) bool

func (*Assertions) HTTPBodyContainsf

func (a *Assertions) HTTPBodyContainsf(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}) bool

func (*Assertions) HTTPBodyNotContains

func (a *Assertions) HTTPBodyNotContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}) bool

func (*Assertions) HTTPBodyNotContainsf

func (a *Assertions) HTTPBodyNotContainsf(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}) bool

func (*Assertions) HTTPError

func (a *Assertions) HTTPError(handler http.HandlerFunc, method string, url string, values url.Values) bool

func (*Assertions) HTTPErrorf

func (a *Assertions) HTTPErrorf(handler http.HandlerFunc, method string, url string, values url.Values) bool

func (*Assertions) HTTPRedirect

func (a *Assertions) HTTPRedirect(handler http.HandlerFunc, method string, url string, values url.Values) bool

func (*Assertions) HTTPRedirectf

func (a *Assertions) HTTPRedirectf(handler http.HandlerFunc, method string, url string, values url.Values) bool

func (*Assertions) HTTPSuccess

func (a *Assertions) HTTPSuccess(handler http.HandlerFunc, method string, url string, values url.Values) bool

func (*Assertions) HTTPSuccessf

func (a *Assertions) HTTPSuccessf(handler http.HandlerFunc, method string, url string, values url.Values) bool

func (*Assertions) Implements

func (a *Assertions) Implements(interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) bool

func (*Assertions) Implementsf

func (a *Assertions) Implementsf(interfaceObject interface{}, object interface{}, msg string, args ...interface{}) bool

func (*Assertions) InDelta

func (a *Assertions) InDelta(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) bool

func (*Assertions) InDeltaSlice

func (a *Assertions) InDeltaSlice(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) bool

func (*Assertions) InDeltaSlicef

func (a *Assertions) InDeltaSlicef(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool

func (*Assertions) InDeltaf

func (a *Assertions) InDeltaf(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool

func (*Assertions) InEpsilon

func (a *Assertions) InEpsilon(expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) bool

func (*Assertions) InEpsilonSlice

func (a *Assertions) InEpsilonSlice(expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) bool

func (*Assertions) InEpsilonSlicef

func (a *Assertions) InEpsilonSlicef(expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool

func (*Assertions) InEpsilonf

func (a *Assertions) InEpsilonf(expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool

func (*Assertions) IsType

func (a *Assertions) IsType(expectedType interface{}, object interface{}, msgAndArgs ...interface{}) bool

func (*Assertions) IsTypef

func (a *Assertions) IsTypef(expectedType interface{}, object interface{}, msg string, args ...interface{}) bool

func (*Assertions) JSONEq

func (a *Assertions) JSONEq(expected string, actual string, msgAndArgs ...interface{}) bool

func (*Assertions) JSONEqf

func (a *Assertions) JSONEqf(expected string, actual string, msg string, args ...interface{}) bool

func (*Assertions) Len

func (a *Assertions) Len(object interface{}, length int, msgAndArgs ...interface{}) bool

func (*Assertions) Lenf

func (a *Assertions) Lenf(object interface{}, length int, msg string, args ...interface{}) bool

func (*Assertions) Nil

func (a *Assertions) Nil(object interface{}, msgAndArgs ...interface{}) bool

func (*Assertions) Nilf

func (a *Assertions) Nilf(object interface{}, msg string, args ...interface{}) bool

func (*Assertions) NoError

func (a *Assertions) NoError(err error, msgAndArgs ...interface{}) bool

func (*Assertions) NoErrorf

func (a *Assertions) NoErrorf(err error, msg string, args ...interface{}) bool

func (*Assertions) NotContains

func (a *Assertions) NotContains(s interface{}, contains interface{}, msgAndArgs ...interface{}) bool

func (*Assertions) NotContainsf

func (a *Assertions) NotContainsf(s interface{}, contains interface{}, msg string, args ...interface{}) bool

func (*Assertions) NotEmpty

func (a *Assertions) NotEmpty(object interface{}, msgAndArgs ...interface{}) bool

func (*Assertions) NotEmptyf

func (a *Assertions) NotEmptyf(object interface{}, msg string, args ...interface{}) bool

func (*Assertions) NotEqual

func (a *Assertions) NotEqual(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool

func (*Assertions) NotEqualf

func (a *Assertions) NotEqualf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool

func (*Assertions) NotNil

func (a *Assertions) NotNil(object interface{}, msgAndArgs ...interface{}) bool

func (*Assertions) NotNilf

func (a *Assertions) NotNilf(object interface{}, msg string, args ...interface{}) bool

func (*Assertions) NotPanics

func (a *Assertions) NotPanics(f PanicTestFunc, msgAndArgs ...interface{}) bool

func (*Assertions) NotPanicsf

func (a *Assertions) NotPanicsf(f PanicTestFunc, msg string, args ...interface{}) bool

func (*Assertions) NotRegexp

func (a *Assertions) NotRegexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) bool

func (*Assertions) NotRegexpf

func (a *Assertions) NotRegexpf(rx interface{}, str interface{}, msg string, args ...interface{}) bool

func (*Assertions) NotSubset

func (a *Assertions) NotSubset(list interface{}, subset interface{}, msgAndArgs ...interface{}) bool

func (*Assertions) NotSubsetf

func (a *Assertions) NotSubsetf(list interface{}, subset interface{}, msg string, args ...interface{}) bool

func (*Assertions) NotZero

func (a *Assertions) NotZero(i interface{}, msgAndArgs ...interface{}) bool

func (*Assertions) NotZerof

func (a *Assertions) NotZerof(i interface{}, msg string, args ...interface{}) bool

func (*Assertions) Panics

func (a *Assertions) Panics(f PanicTestFunc, msgAndArgs ...interface{}) bool

func (*Assertions) PanicsWithValue

func (a *Assertions) PanicsWithValue(expected interface{}, f PanicTestFunc, msgAndArgs ...interface{}) bool

func (*Assertions) PanicsWithValuef

func (a *Assertions) PanicsWithValuef(expected interface{}, f PanicTestFunc, msg string, args ...interface{}) bool

func (*Assertions) Panicsf

func (a *Assertions) Panicsf(f PanicTestFunc, msg string, args ...interface{}) bool

func (*Assertions) Regexp

func (a *Assertions) Regexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) bool

func (*Assertions) Regexpf

func (a *Assertions) Regexpf(rx interface{}, str interface{}, msg string, args ...interface{}) bool

func (*Assertions) Subset

func (a *Assertions) Subset(list interface{}, subset interface{}, msgAndArgs ...interface{}) bool

func (*Assertions) Subsetf

func (a *Assertions) Subsetf(list interface{}, subset interface{}, msg string, args ...interface{}) bool

func (*Assertions) True

func (a *Assertions) True(value bool, msgAndArgs ...interface{}) bool

func (*Assertions) Truef

func (a *Assertions) Truef(value bool, msg string, args ...interface{}) bool

func (*Assertions) WithinDuration

func (a *Assertions) WithinDuration(expected time.Time, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) bool

func (*Assertions) WithinDurationf

func (a *Assertions) WithinDurationf(expected time.Time, actual time.Time, delta time.Duration, msg string, args ...interface{}) bool

func (*Assertions) Zero

func (a *Assertions) Zero(i interface{}, msgAndArgs ...interface{}) bool

func (*Assertions) Zerof

func (a *Assertions) Zerof(i interface{}, msg string, args ...interface{}) bool

type Comparison

type Comparison func() (success bool)

type ContextDiff

type ContextDiff UnifiedDiff

type Match

type Match struct {
	A    int
	B    int
	Size int
}

type OpCode

type OpCode struct {
	Tag byte
	I1  int
	I2  int
	J1  int
	J2  int
}

type PanicTestFunc

type PanicTestFunc func()

type SequenceMatcher

type SequenceMatcher struct {
	IsJunk func(string) bool
	// contains filtered or unexported fields
}

func NewMatcher

func NewMatcher(a, b []string) *SequenceMatcher

func NewMatcherWithJunk

func NewMatcherWithJunk(a, b []string, autoJunk bool,
	isJunk func(string) bool) *SequenceMatcher

func (*SequenceMatcher) GetGroupedOpCodes

func (m *SequenceMatcher) GetGroupedOpCodes(n int) [][]OpCode

func (*SequenceMatcher) GetMatchingBlocks

func (m *SequenceMatcher) GetMatchingBlocks() []Match

func (*SequenceMatcher) GetOpCodes

func (m *SequenceMatcher) GetOpCodes() []OpCode

func (*SequenceMatcher) QuickRatio

func (m *SequenceMatcher) QuickRatio() float64

func (*SequenceMatcher) Ratio

func (m *SequenceMatcher) Ratio() float64

func (*SequenceMatcher) RealQuickRatio

func (m *SequenceMatcher) RealQuickRatio() float64

func (*SequenceMatcher) SetSeq1

func (m *SequenceMatcher) SetSeq1(a []string)

func (*SequenceMatcher) SetSeq2

func (m *SequenceMatcher) SetSeq2(b []string)

func (*SequenceMatcher) SetSeqs

func (m *SequenceMatcher) SetSeqs(a, b []string)

type TestingT

type TestingT interface {
	Errorf(format string, args ...interface{})
}

type UnifiedDiff

type UnifiedDiff struct {
	A        []string // First sequence lines
	FromFile string   // First file name
	FromDate string   // First file time
	B        []string // Second sequence lines
	ToFile   string   // Second file name
	ToDate   string   // Second file time
	Eol      string   // Headers end of line, defaults to LF
	Context  int      // Number of context lines
}

Jump to

Keyboard shortcuts

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