coretests

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2022 License: MIT Imports: 14 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnyToBytes added in v1.1.0

func AnyToBytes(anyItem interface{}) []byte

func AnyToBytesPtr added in v1.1.0

func AnyToBytesPtr(anyItem interface{}) *[]byte

func GetAssertMessage added in v0.0.4

func GetAssertMessage(testCaseMessenger TestCaseMessenger, counter int) string

func GetAssertMessageQuick added in v0.0.4

func GetAssertMessageQuick(
	when,
	actual,
	expected interface{},
	counter int,
) string

GetAssertMessageQuick

Gives generic and consistent test message using msgformats.QuickIndexInputActualExpectedMessageFormat

func GetAssertMessageUsingSimpleTestCaseWrapper added in v1.1.0

func GetAssertMessageUsingSimpleTestCaseWrapper(testCaseIndex int, testCaseWrapper SimpleTestCaseWrapper) string

GetAssertMessageUsingSimpleTestCaseWrapper

Gives generic and consistent test message using msgformats.QuickIndexTitleInputActualExpectedMessageFormat

func GetMessageToSorted added in v0.6.2

func GetMessageToSorted(
	isPrint bool,
	message,
	joiner string,
) string

func GetMessageToSortedArray added in v0.6.2

func GetMessageToSortedArray(
	isPrint bool,
	isSort bool,
	message string,
) []string

func GetMessageToSortedArrayDefault added in v0.6.2

func GetMessageToSortedArrayDefault(
	message string,
) []string

GetMessageToSortedArrayDefault

isPrint: false, isSort: true

func GetTestHeader added in v0.0.4

func GetTestHeader(testCaseMessenger TestCaseMessenger) string

func GetTrimmedNonEmptySpaceSplit added in v0.6.4

func GetTrimmedNonEmptySpaceSplit(
	message string,
	isSort bool,
) []string

func IsErrorNonWhiteSortedEqual added in v0.7.3

func IsErrorNonWhiteSortedEqual(
	isPrintOnFail bool,
	actual error,
	expectationMessageDef *errcore.ExpectationMessageDef,
) bool

func IsStrMsgNonWhiteSortedEqual added in v0.7.3

func IsStrMsgNonWhiteSortedEqual(
	isPrintOnFail bool,
	actual string,
	expectationMessageDef *errcore.ExpectationMessageDef,
) bool

func LogOnFail added in v0.3.8

func LogOnFail(
	isPass bool,
	expected, actual interface{},
)

func PrintFailedExpected added in v0.6.2

func PrintFailedExpected(
	isFailed bool,
	when,
	actual,
	expected interface{},
	counter int,
)

func PrintNameValue added in v0.3.8

func PrintNameValue(header string, any interface{})

func PrintValue added in v0.3.8

func PrintValue(header string, any interface{})

func SkipOnUnix

func SkipOnUnix(t *testing.T)

SkipOnUnix Skip on Unix

func SkipOnWindows

func SkipOnWindows(t *testing.T)

SkipOnWindows Skip on Windows

func ToStringNameValues added in v0.3.8

func ToStringNameValues(any interface{}) string

func ToStringValues added in v0.3.8

func ToStringValues(any interface{}) string

Types

type BaseTestCase added in v1.1.0

type BaseTestCase struct {
	Title                                    string // consider as header
	ArrangeInput, ActualInput, ExpectedInput interface{}
	HasError                                 bool
	IsValidateError                          bool
}

func (*BaseTestCase) Actual added in v1.1.0

func (it *BaseTestCase) Actual() interface{}

func (*BaseTestCase) ActualString added in v1.1.0

func (it *BaseTestCase) ActualString() string

func (*BaseTestCase) ArrangeString added in v1.1.0

func (it *BaseTestCase) ArrangeString() string

func (*BaseTestCase) AsSimpleTestCaseWrapper added in v1.1.0

func (it *BaseTestCase) AsSimpleTestCaseWrapper() SimpleTestCaseWrapper

func (*BaseTestCase) CaseTitle added in v1.1.0

func (it *BaseTestCase) CaseTitle() string

func (*BaseTestCase) Expected added in v1.1.0

func (it *BaseTestCase) Expected() interface{}

func (*BaseTestCase) ExpectedString added in v1.1.0

func (it *BaseTestCase) ExpectedString() string

func (*BaseTestCase) Input added in v1.1.0

func (it *BaseTestCase) Input() interface{}

func (*BaseTestCase) SetActual added in v1.1.0

func (it *BaseTestCase) SetActual(actual interface{})

func (*BaseTestCase) String added in v1.1.0

func (it *BaseTestCase) String(caseIndex int) string

type CaseIndexPlusIsPrint added in v0.7.3

type CaseIndexPlusIsPrint struct {
	IsPrint   bool
	CaseIndex int
}

type Compare added in v0.6.3

type Compare struct {
	MatchingLength int // 0/-1 means all, number means, that number must match
	StringContains string
	// contains filtered or unexported fields
}

func (*Compare) GetPrintMessage added in v0.6.3

func (it *Compare) GetPrintMessage(index int) string

func (*Compare) IsMatch added in v0.6.3

func (it *Compare) IsMatch(
	isPrint bool,
	index int,
	instruction *ComparingInstruction,
) bool

func (*Compare) SortedString added in v0.6.3

func (it *Compare) SortedString() string

func (*Compare) SortedStrings added in v0.6.3

func (it *Compare) SortedStrings() []string

type ComparingInstruction added in v0.6.3

type ComparingInstruction struct {
	FunName,
	Header,
	TestCaseName,
	MatchingAsEqualExpectation string
	ComparingItems                   []Compare
	HasWhitespace, IsMatchingAsEqual bool
	// contains filtered or unexported fields
}

func (*ComparingInstruction) Actual added in v0.6.3

func (it *ComparingInstruction) Actual() string

func (*ComparingInstruction) ActualHashset added in v0.6.3

func (it *ComparingInstruction) ActualHashset() *corestr.Hashset

func (*ComparingInstruction) IsMatch added in v0.6.9

func (it *ComparingInstruction) IsMatch(
	caseIndexPlusIsPrint *CaseIndexPlusIsPrint,
) bool

func (*ComparingInstruction) SetActual added in v0.6.4

func (it *ComparingInstruction) SetActual(actual string)

type DraftType added in v1.1.0

type DraftType struct {
	SampleString1, SampleString2 string
	SampleInteger                int
	Lines                        []string
	RawBytes                     []byte
	// contains filtered or unexported fields
}

func AnyToDraftType added in v1.1.0

func AnyToDraftType(anyItem interface{}) *DraftType

func (DraftType) Clone added in v1.1.0

func (it DraftType) Clone() DraftType

func (*DraftType) ClonePtr added in v1.1.0

func (it *DraftType) ClonePtr() *DraftType

func (DraftType) F1String added in v1.1.0

func (it DraftType) F1String() string

func (DraftType) F2Integer added in v1.1.0

func (it DraftType) F2Integer() int

func (*DraftType) IsEqual added in v1.1.0

func (it *DraftType) IsEqual(
	isIncludingInnerFields bool,
	right *DraftType,
) bool

func (*DraftType) IsEqualAll added in v1.1.0

func (it *DraftType) IsEqualAll(
	right *DraftType,
) bool

func (DraftType) JsonBytes added in v1.1.0

func (it DraftType) JsonBytes() []byte

func (DraftType) JsonBytesPtr added in v1.1.0

func (it DraftType) JsonBytesPtr() *[]byte

func (DraftType) JsonString added in v1.1.0

func (it DraftType) JsonString() string

func (*DraftType) LinesLength added in v1.1.0

func (it *DraftType) LinesLength() int

func (DraftType) NonPtr added in v1.1.0

func (it DraftType) NonPtr() DraftType

func (*DraftType) PtrOrNonPtr added in v1.1.0

func (it *DraftType) PtrOrNonPtr(isPtr bool) interface{}

func (*DraftType) RawBytesLength added in v1.1.0

func (it *DraftType) RawBytesLength() int

func (*DraftType) SetF2Integer added in v1.1.0

func (it *DraftType) SetF2Integer(f2Integer int)

func (*DraftType) VerifyAllNotEqualErr added in v1.1.0

func (it *DraftType) VerifyAllNotEqualErr(
	right *DraftType,
) error

func (*DraftType) VerifyAllNotEqualMessage added in v1.1.0

func (it *DraftType) VerifyAllNotEqualMessage(
	right *DraftType,
) string

func (*DraftType) VerifyNotEqualErr added in v1.1.0

func (it *DraftType) VerifyNotEqualErr(
	isIncludingInnerFields bool,
	right *DraftType,
) error

func (*DraftType) VerifyNotEqualExcludingInnerFieldsErr added in v1.1.0

func (it *DraftType) VerifyNotEqualExcludingInnerFieldsErr(
	right *DraftType,
) error

func (*DraftType) VerifyNotEqualMessage added in v1.1.0

func (it *DraftType) VerifyNotEqualMessage(
	isIncludingInnerFields bool,
	right *DraftType,
) string

type SimpleGherkins added in v0.6.9

type SimpleGherkins struct {
	Feature,
	Given,
	When,
	Then,
	Expect,
	Actual string
}

SimpleGherkins

https://www.guru99.com/gherkin-test-cucumber.html Feature: Login functionality of social networking site Facebook. Given: I am a facebook user. When: I enter username as username. And I enter the password as the password Then I should be redirected to the home page of facebook Given -> When -> Then

func (*SimpleGherkins) GetMessageConditional added in v0.6.9

func (it *SimpleGherkins) GetMessageConditional(
	isExpectation bool,
	testIndex int,
) string

func (*SimpleGherkins) GetWithExpectation added in v0.6.9

func (it *SimpleGherkins) GetWithExpectation(
	testIndex int,
) string

func (*SimpleGherkins) String added in v0.6.9

func (it *SimpleGherkins) String() string

func (*SimpleGherkins) ToString added in v0.6.9

func (it *SimpleGherkins) ToString(testIndex int) string

type SimpleTestCaseWrapper added in v1.1.0

type SimpleTestCaseWrapper interface {
	CaseTitle() string
	Input() interface{}
	Expected() interface{}
	Actual() interface{}
}

type SimpleTestCaseWrapperContractsBinder added in v1.1.0

type SimpleTestCaseWrapperContractsBinder interface {
	SimpleTestCaseWrapper
	AsSimpleTestCaseWrapper() SimpleTestCaseWrapper
}

type TestCaseMessenger added in v0.0.4

type TestCaseMessenger interface {
	FuncName() string
	Value() interface{}
	Expected() interface{}
	Actual() interface{}
}

type TestFuncName added in v0.0.4

type TestFuncName string

func (TestFuncName) Value added in v0.0.4

func (funcName TestFuncName) Value() string

Jump to

Keyboard shortcuts

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