Documentation
¶
Index ¶
- type AssertableAny
- func (a AssertableAny) HasTypeOf(t reflect.Type) AssertableAny
- func (a AssertableAny) IsEqualTo(expected interface{}) AssertableAny
- func (a AssertableAny) IsFalse() AssertableAny
- func (a AssertableAny) IsNil() AssertableAny
- func (a AssertableAny) IsNotEqualTo(expected interface{}) AssertableAny
- func (a AssertableAny) IsNotNil() AssertableAny
- func (a AssertableAny) IsTrue() AssertableAny
- type AssertableBool
- type AssertableDuration
- func (a AssertableDuration) IsEqualTo(expected time.Duration) AssertableDuration
- func (a AssertableDuration) IsLongerThan(expected time.Duration) AssertableDuration
- func (a AssertableDuration) IsNotEqualTo(expected time.Duration) AssertableDuration
- func (a AssertableDuration) IsShorterThan(expected time.Duration) AssertableDuration
- type AssertableError
- type AssertableInt
- func (a AssertableInt) IsEqualTo(expected int) AssertableInt
- func (a AssertableInt) IsGreaterThan(expected int) AssertableInt
- func (a AssertableInt) IsGreaterThanOrEqualTo(expected int) AssertableInt
- func (a AssertableInt) IsLessThan(expected int) AssertableInt
- func (a AssertableInt) IsLessThanOrEqualTo(expected int) AssertableInt
- func (a AssertableInt) IsNotEqualTo(expected int) AssertableInt
- type AssertableMap
- func (a AssertableMap) HasEntry(value types.MapEntry) AssertableMap
- func (a AssertableMap) HasKey(elements interface{}) AssertableMap
- func (a AssertableMap) HasNotEntry(value types.MapEntry) AssertableMap
- func (a AssertableMap) HasNotKey(elements interface{}) AssertableMap
- func (a AssertableMap) HasNotValue(elements interface{}) AssertableMap
- func (a AssertableMap) HasSize(size int) AssertableMap
- func (a AssertableMap) HasValue(elements interface{}) AssertableMap
- func (a AssertableMap) IsEmpty() AssertableMap
- func (a AssertableMap) IsEqualTo(expected interface{}) AssertableMap
- func (a AssertableMap) IsNotEmpty() AssertableMap
- func (a AssertableMap) IsNotEqualTo(expected interface{}) AssertableMap
- type AssertableSlice
- func (a AssertableSlice) Contains(elements interface{}) AssertableSlice
- func (a AssertableSlice) ContainsOnly(elements interface{}) AssertableSlice
- func (a AssertableSlice) DoesNotContain(elements interface{}) AssertableSlice
- func (a AssertableSlice) HasSize(size int) AssertableSlice
- func (a AssertableSlice) HasUniqueElements() AssertableSlice
- func (a AssertableSlice) IsEmpty() AssertableSlice
- func (a AssertableSlice) IsEqualTo(expected interface{}) AssertableSlice
- func (a AssertableSlice) IsNotEmpty() AssertableSlice
- func (a AssertableSlice) IsNotEqualTo(expected interface{}) AssertableSlice
- func (a AssertableSlice) IsSortedAscending() AssertableSlice
- func (a AssertableSlice) IsSortedDescending() AssertableSlice
- type AssertableString
- func (a AssertableString) Contains(substring string) AssertableString
- func (a AssertableString) ContainsIgnoringCase(substring string) AssertableString
- func (a AssertableString) ContainsOnly(substring string) AssertableString
- func (a AssertableString) ContainsOnlyDigits() AssertableString
- func (a AssertableString) ContainsOnlyOnce(substring string) AssertableString
- func (a AssertableString) ContainsOnlyWhitespaces() AssertableString
- func (a AssertableString) ContainsWhitespaces() AssertableString
- func (a AssertableString) DoesNotContain(substring string) AssertableString
- func (a AssertableString) DoesNotContainAnyWhitespaces() AssertableString
- func (a AssertableString) DoesNotContainOnlyWhitespaces() AssertableString
- func (a AssertableString) DoesNotEndWith(substring string) AssertableString
- func (a AssertableString) DoesNotStartWith(substring string) AssertableString
- func (a AssertableString) EndsWith(substring string) AssertableString
- func (a AssertableString) HasSameSizeAs(substring string) AssertableString
- func (a AssertableString) HasSizeBetween(shortString, longString string) AssertableString
- func (a AssertableString) HasSizeGreaterThan(substring string) AssertableString
- func (a AssertableString) HasSizeGreaterThanOrEqualTo(substring string) AssertableString
- func (a AssertableString) HasSizeLessThan(substring string) AssertableString
- func (a AssertableString) HasSizeLessThanOrEqualTo(substring string) AssertableString
- func (a AssertableString) IsEmpty() AssertableString
- func (a AssertableString) IsEqualTo(expected interface{}) AssertableString
- func (a AssertableString) IsLowerCase() AssertableString
- func (a AssertableString) IsNotEmpty() AssertableString
- func (a AssertableString) IsNotEqualTo(expected interface{}) AssertableString
- func (a AssertableString) IsSubstringOf(someString string) AssertableString
- func (a AssertableString) IsUpperCase() AssertableString
- func (a AssertableString) StartsWith(substring string) AssertableString
- type AssertableStruct
- type AssertableTime
- func (a AssertableTime) IsAfter(expected time.Time) AssertableTime
- func (a AssertableTime) IsAlmostSameAs(expected time.Time) AssertableTime
- func (a AssertableTime) IsBefore(expected time.Time) AssertableTime
- func (a AssertableTime) IsDefined() AssertableTime
- func (a AssertableTime) IsNotDefined() AssertableTime
- func (a AssertableTime) IsNotTheSameAs(expected time.Time) AssertableTime
- func (a AssertableTime) IsSameAs(expected time.Time) AssertableTime
- type FluentT
- func (t FluentT) AssertThat(actual interface{}) AssertableAny
- func (t FluentT) AssertThatBool(actual bool) AssertableBool
- func (t FluentT) AssertThatDuration(actual time.Duration) AssertableDuration
- func (t FluentT) AssertThatInt(actual int) AssertableInt
- func (t FluentT) AssertThatSlice(actual interface{}, opts ...SliceOpt) AssertableSlice
- func (t FluentT) AssertThatString(actual string, opts ...StringOpt) AssertableString
- func (t FluentT) AssertThatStruct(actual interface{}) AssertableStruct
- func (t FluentT) AssertThatTime(actual time.Time) AssertableTime
- type SliceOpt
- type StringOpt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AssertableAny ¶ added in v0.0.3
type AssertableAny struct {
// contains filtered or unexported fields
}
AssertableAny is the assertable structure for interface{} values.
func That ¶
func That(t *testing.T, actual interface{}) AssertableAny
That returns an AssertableAny structure initialized with the test reference and the actual value to assert.
func (AssertableAny) HasTypeOf ¶ added in v0.0.4
func (a AssertableAny) HasTypeOf(t reflect.Type) AssertableAny
HasTypeOf asserts if the expected value has the type of a given value.
func (AssertableAny) IsEqualTo ¶ added in v0.0.3
func (a AssertableAny) IsEqualTo(expected interface{}) AssertableAny
IsEqualTo asserts if the expected interface is equal to the assertable value It errors the tests if the compared values (actual VS expected) are not equal.
func (AssertableAny) IsFalse ¶ added in v0.0.3
func (a AssertableAny) IsFalse() AssertableAny
IsFalse asserts if the expected value is false.
func (AssertableAny) IsNil ¶ added in v0.0.3
func (a AssertableAny) IsNil() AssertableAny
IsNil asserts if the expected value is nil.
func (AssertableAny) IsNotEqualTo ¶ added in v0.0.3
func (a AssertableAny) IsNotEqualTo(expected interface{}) AssertableAny
IsNotEqualTo asserts if the expected interface is not qual to the assertable value It errors the tests if the compared values (actual VS expected) are equal.
func (AssertableAny) IsNotNil ¶ added in v0.0.3
func (a AssertableAny) IsNotNil() AssertableAny
IsNotNil asserts if the expected value is not nil.
func (AssertableAny) IsTrue ¶ added in v0.0.3
func (a AssertableAny) IsTrue() AssertableAny
IsTrue asserts if the expected value is true.
type AssertableBool ¶
type AssertableBool struct {
// contains filtered or unexported fields
}
AssertableBool is the assertable structure for bool values.
func ThatBool ¶
func ThatBool(t *testing.T, actual bool) AssertableBool
ThatBool returns an AssertableBool structure initialized with the test reference and the actual bool value to assert.
func (AssertableBool) IsEqualTo ¶
func (a AssertableBool) IsEqualTo(expected interface{}) AssertableBool
IsEqualTo asserts if the expected bool is equal to the assertable bool value It errors the tests if the compared values (actual VS expected) are not equal.
func (AssertableBool) IsFalse ¶
func (a AssertableBool) IsFalse() AssertableBool
IsFalse asserts if the expected bool value is false.
func (AssertableBool) IsNotEqualTo ¶
func (a AssertableBool) IsNotEqualTo(expected interface{}) AssertableBool
IsNotEqualTo asserts if the expected bool is not equal to the assertable bool value It errors the tests if the compared values (actual VS expected) are equal.
func (AssertableBool) IsTrue ¶
func (a AssertableBool) IsTrue() AssertableBool
IsTrue asserts if the expected bool value is true.
type AssertableDuration ¶ added in v0.0.3
type AssertableDuration struct {
// contains filtered or unexported fields
}
AssertableDuration is the assertable structure for time.Duration values.
func ThatDuration ¶ added in v0.0.3
func ThatDuration(t *testing.T, actual time.Duration) AssertableDuration
ThatDuration returns an AssertableDuration structure initialized with the test reference and the actual value to assert.
func (AssertableDuration) IsEqualTo ¶ added in v0.0.3
func (a AssertableDuration) IsEqualTo(expected time.Duration) AssertableDuration
IsEqualTo asserts if the expected time.Duration is equal to the assertable time.Duration value It errors the tests if the compared values (actual VS expected) are not equal.
func (AssertableDuration) IsLongerThan ¶ added in v0.0.3
func (a AssertableDuration) IsLongerThan(expected time.Duration) AssertableDuration
IsLongerThan asserts if the assertable time.v value is longer than the expected value It errors the tests if is not longer.
func (AssertableDuration) IsNotEqualTo ¶ added in v0.0.3
func (a AssertableDuration) IsNotEqualTo(expected time.Duration) AssertableDuration
IsNotEqualTo asserts if the expected time.Duration is not equal to the assertable time.Duration value It errors the tests if the compared values (actual VS expected) are equal.
func (AssertableDuration) IsShorterThan ¶ added in v0.0.3
func (a AssertableDuration) IsShorterThan(expected time.Duration) AssertableDuration
IsShorterThan asserts if the assertable time.Duration value is shorter than the expected value It errors the tests if is not shorter.
type AssertableError ¶ added in v0.0.6
type AssertableError struct {
// contains filtered or unexported fields
}
AssertableError is the assertable structure for error values.
func ThatError ¶ added in v0.0.6
func ThatError(t *testing.T, actual error) AssertableError
ThatError returns an AssertableError structure initialized with the test reference and the actual value to assert.
func (AssertableError) HasExactMessage ¶ added in v0.0.6
func (a AssertableError) HasExactMessage(expectedMessage string) AssertableError
HasExactMessage asserts if the expected error contains exactly the given message.
func (AssertableError) IsNil ¶ added in v0.0.6
func (a AssertableError) IsNil() AssertableError
IsNil asserts if the expected error is nil.
func (AssertableError) IsNotNil ¶ added in v0.0.6
func (a AssertableError) IsNotNil() AssertableError
IsNotNil asserts if the expected error is nil.
func (AssertableError) IsSameAs ¶ added in v0.0.6
func (a AssertableError) IsSameAs(err error) AssertableError
IsSameAs asserts if the expected error is the same with the given error.
type AssertableInt ¶
type AssertableInt struct {
// contains filtered or unexported fields
}
AssertableInt is the assertable structure for int values.
func ThatInt ¶
func ThatInt(t *testing.T, actual int) AssertableInt
ThatInt returns an AssertableInt structure initialized with the test reference and the actual value to assert.
func (AssertableInt) IsEqualTo ¶
func (a AssertableInt) IsEqualTo(expected int) AssertableInt
IsEqualTo asserts if the expected int is equal to the assertable int value It errors the tests if the compared values (actual VS expected) are not equal.
func (AssertableInt) IsGreaterThan ¶
func (a AssertableInt) IsGreaterThan(expected int) AssertableInt
IsGreaterThan asserts if the assertable int value is greater than the expected value It errors the tests if is not greater.
func (AssertableInt) IsGreaterThanOrEqualTo ¶
func (a AssertableInt) IsGreaterThanOrEqualTo(expected int) AssertableInt
IsGreaterThanOrEqualTo asserts if the assertable int value is greater than or equal to the expected value It errors the tests if is not greater.
func (AssertableInt) IsLessThan ¶
func (a AssertableInt) IsLessThan(expected int) AssertableInt
IsLessThan asserts if the assertable int value is less than the expected value It errors the tests if is not greater.
func (AssertableInt) IsLessThanOrEqualTo ¶
func (a AssertableInt) IsLessThanOrEqualTo(expected int) AssertableInt
IsLessThanOrEqualTo asserts if the assertable int value is less than or equal to the expected value It errors the tests if is not greater.
func (AssertableInt) IsNotEqualTo ¶
func (a AssertableInt) IsNotEqualTo(expected int) AssertableInt
IsNotEqualTo asserts if the expected int is not equal to the assertable int value It errors the tests if the compared values (actual VS expected) are equal.
type AssertableMap ¶ added in v0.0.3
type AssertableMap struct {
// contains filtered or unexported fields
}
AssertableMap is the structure to assert maps.
func ThatMap ¶ added in v0.0.3
func ThatMap(t *testing.T, actual interface{}) AssertableMap
ThatMap returns a proper assertable structure based on the map key type.
func (AssertableMap) HasEntry ¶ added in v0.0.3
func (a AssertableMap) HasEntry(value types.MapEntry) AssertableMap
HasEntry asserts if the assertable map has the given entry It errors the test if * the entry can't be found * the key is not comparable * the asserted type is not a map.
func (AssertableMap) HasKey ¶ added in v0.0.3
func (a AssertableMap) HasKey(elements interface{}) AssertableMap
HasKey asserts if the assertable map has the given key It errors the test if * they key can't be found * the key is not comparable * the asserted type is not a map.
func (AssertableMap) HasNotEntry ¶ added in v0.0.3
func (a AssertableMap) HasNotEntry(value types.MapEntry) AssertableMap
HasNotEntry asserts if the assertable map has not the given entry It errors the test if * the entry can be found * the key is not comparable * the asserted type is not a map.
func (AssertableMap) HasNotKey ¶ added in v0.0.3
func (a AssertableMap) HasNotKey(elements interface{}) AssertableMap
HasNotKey asserts if the assertable map has not the given key It errors the test if * they key is found * the key is not comparable * the asserted type is not a map.
func (AssertableMap) HasNotValue ¶ added in v0.0.3
func (a AssertableMap) HasNotValue(elements interface{}) AssertableMap
HasNotValue asserts if the assertable map has not the given value It errors the test if * they key can be found * the key is not comparable * the asserted type is not a map.
func (AssertableMap) HasSize ¶ added in v0.0.3
func (a AssertableMap) HasSize(size int) AssertableMap
HasSize asserts if the assertable string map has the expected length size It errors the test if it doesn't have the expected size.
func (AssertableMap) HasValue ¶ added in v0.0.3
func (a AssertableMap) HasValue(elements interface{}) AssertableMap
HasValue asserts if the assertable map has the given value It errors the test if * they key can't be found * the key is not comparable * the asserted type is not a map.
func (AssertableMap) IsEmpty ¶ added in v0.0.3
func (a AssertableMap) IsEmpty() AssertableMap
IsEmpty asserts if the assertable string map is empty or not.
func (AssertableMap) IsEqualTo ¶ added in v0.0.3
func (a AssertableMap) IsEqualTo(expected interface{}) AssertableMap
IsEqualTo asserts if the expected map is equal to the assertable map value It errors the tests if the compared values (actual VS expected) are not equal.
func (AssertableMap) IsNotEmpty ¶ added in v0.0.3
func (a AssertableMap) IsNotEmpty() AssertableMap
IsNotEmpty asserts if the assertable string map is not empty.
func (AssertableMap) IsNotEqualTo ¶ added in v0.0.3
func (a AssertableMap) IsNotEqualTo(expected interface{}) AssertableMap
IsNotEqualTo asserts if the expected map is not equal to the assertable map value It errors the tests if the compared values (actual VS expected) are equal.
type AssertableSlice ¶
type AssertableSlice struct {
// contains filtered or unexported fields
}
AssertableSlice is the implementation of AssertableSlice for string slices.
func ThatSlice ¶
func ThatSlice(t *testing.T, actual interface{}, opts ...SliceOpt) AssertableSlice
ThatSlice returns a proper assertable structure based on the slice type.
func (AssertableSlice) Contains ¶
func (a AssertableSlice) Contains(elements interface{}) AssertableSlice
Contains asserts if the assertable string slice contains the given element(s) It errors the test if it does not contain it/them.
func (AssertableSlice) ContainsOnly ¶
func (a AssertableSlice) ContainsOnly(elements interface{}) AssertableSlice
ContainsOnly asserts if the assertable string slice contains only the given element(s) It errors the test if it does not contain it/them.
func (AssertableSlice) DoesNotContain ¶
func (a AssertableSlice) DoesNotContain(elements interface{}) AssertableSlice
DoesNotContain asserts if the assertable string slice does not contain the given element It errors the test if it contains it/them.
func (AssertableSlice) HasSize ¶
func (a AssertableSlice) HasSize(size int) AssertableSlice
HasSize asserts if the assertable string slice has the expected length size It errors the test if it doesn't have the expected size.
func (AssertableSlice) HasUniqueElements ¶ added in v0.0.7
func (a AssertableSlice) HasUniqueElements() AssertableSlice
HasUniqueElements asserts if the assertable string slice does not contain the given element It errors the test if it contains it/them.
func (AssertableSlice) IsEmpty ¶
func (a AssertableSlice) IsEmpty() AssertableSlice
IsEmpty asserts if the assertable string slice is empty or not.
func (AssertableSlice) IsEqualTo ¶
func (a AssertableSlice) IsEqualTo(expected interface{}) AssertableSlice
IsEqualTo asserts if the expected slice is equal to the assertable slice value It errors the tests if the compared values (actual VS expected) are not equal.
func (AssertableSlice) IsNotEmpty ¶
func (a AssertableSlice) IsNotEmpty() AssertableSlice
IsNotEmpty asserts if the assertable string slice is not empty.
func (AssertableSlice) IsNotEqualTo ¶
func (a AssertableSlice) IsNotEqualTo(expected interface{}) AssertableSlice
IsNotEqualTo asserts if the expected slice is not equal to the assertable slice value It errors the tests if the compared values (actual VS expected) are equal.
func (AssertableSlice) IsSortedAscending ¶ added in v0.0.7
func (a AssertableSlice) IsSortedAscending() AssertableSlice
IsSortedAscending asserts if the assertable slice is sorted on ascending order. It supports the following slices : []string, []int, []int32, []int64, []float64 and any slice that implements sort.Interface If a non-supported type is given then the assertion will fail.
func (AssertableSlice) IsSortedDescending ¶ added in v0.0.7
func (a AssertableSlice) IsSortedDescending() AssertableSlice
IsSortedDescending asserts if the assertable slice is sorted on descending order. It supports the following slices : []string, []int, []int32, []int64, []float64 and any slice that implements sort.Interface If a non-supported type is given then the assertion will fail.
type AssertableString ¶
type AssertableString struct {
// contains filtered or unexported fields
}
AssertableString is the implementation of CommonAssertable for string types.
func ThatString ¶
func ThatString(t *testing.T, actual string, opts ...StringOpt) AssertableString
ThatString returns an AssertableString structure initialized with the test reference and the actual value to assert.
func (AssertableString) Contains ¶ added in v0.0.2
func (a AssertableString) Contains(substring string) AssertableString
Contains asserts if the assertable string contains the given element(s) It errors the test if it does not contain it.
func (AssertableString) ContainsIgnoringCase ¶ added in v0.0.4
func (a AssertableString) ContainsIgnoringCase(substring string) AssertableString
ContainsIgnoringCase asserts if the assertable string contains the given element(s) case insensitively It errors the test if it does not contain it.
func (AssertableString) ContainsOnly ¶ added in v0.0.2
func (a AssertableString) ContainsOnly(substring string) AssertableString
ContainsOnly asserts if the assertable string only contains the given substring It errors the test if it does not contain it.
func (AssertableString) ContainsOnlyDigits ¶ added in v0.0.3
func (a AssertableString) ContainsOnlyDigits() AssertableString
ContainsOnlyDigits asserts if the expected string contains only digits It errors the tests if the string has other characters than digits.
func (AssertableString) ContainsOnlyOnce ¶ added in v0.0.4
func (a AssertableString) ContainsOnlyOnce(substring string) AssertableString
ContainsOnlyOnce asserts if the assertable string contains the given substring only once It errors the test if it does not contain it or contains more than once.
func (AssertableString) ContainsOnlyWhitespaces ¶ added in v0.0.7
func (a AssertableString) ContainsOnlyWhitespaces() AssertableString
ContainsOnlyWhitespaces asserts if the assertable string contains only whitespaces It errors the test if it contains any other character.
func (AssertableString) ContainsWhitespaces ¶ added in v0.0.6
func (a AssertableString) ContainsWhitespaces() AssertableString
ContainsWhitespaces asserts if the assertable string contains at least one whitespace It errors the test if it does not contain any.
func (AssertableString) DoesNotContain ¶ added in v0.0.2
func (a AssertableString) DoesNotContain(substring string) AssertableString
DoesNotContain asserts if the assertable string does not contain the given substring It errors the test if it contains it.
func (AssertableString) DoesNotContainAnyWhitespaces ¶ added in v0.0.6
func (a AssertableString) DoesNotContainAnyWhitespaces() AssertableString
DoesNotContainAnyWhitespaces asserts if the assertable string contains no whitespace It errors the test if it does contain any.
func (AssertableString) DoesNotContainOnlyWhitespaces ¶ added in v0.0.7
func (a AssertableString) DoesNotContainOnlyWhitespaces() AssertableString
DoesNotContainOnlyWhitespaces asserts if the assertable string does not contain only whitespaces It errors the test if it contains only whitespaces.
func (AssertableString) DoesNotEndWith ¶ added in v0.0.5
func (a AssertableString) DoesNotEndWith(substring string) AssertableString
DoesNotEndWith asserts if the assertable string doesn't end with the given substring It errors the test if it end with the given substring.
func (AssertableString) DoesNotStartWith ¶ added in v0.0.5
func (a AssertableString) DoesNotStartWith(substring string) AssertableString
DoesNotStartWith asserts if the assertable string doesn't start with the given substring It errors the test if it starts with the given substring.
func (AssertableString) EndsWith ¶ added in v0.0.3
func (a AssertableString) EndsWith(substring string) AssertableString
EndsWith asserts if the assertable string ends with the given substring It errors the test if it doesn't end with the given substring.
func (AssertableString) HasSameSizeAs ¶ added in v0.0.3
func (a AssertableString) HasSameSizeAs(substring string) AssertableString
HasSameSizeAs asserts if the assertable string has the same size with the given string It errors the test if they don't have the same size.
func (AssertableString) HasSizeBetween ¶ added in v0.0.8
func (a AssertableString) HasSizeBetween(shortString, longString string) AssertableString
HasSizeBetween asserts if the assertable string has bigger size of the first given string and less size than the second given string It errors the test if the assertable string has the same or less size than the first string or greater than or the same size to the second string.
func (AssertableString) HasSizeGreaterThan ¶ added in v0.0.8
func (a AssertableString) HasSizeGreaterThan(substring string) AssertableString
HasSizeGreaterThan asserts if the assertable string has bigger size of the given string It errors the test if the assertable string has the less or equal size to the given one.
func (AssertableString) HasSizeGreaterThanOrEqualTo ¶ added in v0.0.8
func (a AssertableString) HasSizeGreaterThanOrEqualTo(substring string) AssertableString
HasSizeGreaterThanOrEqualTo asserts if the assertable string has bigger os the same size of the given string It errors the test if the assertable string has the less size to the given one.
func (AssertableString) HasSizeLessThan ¶ added in v0.0.7
func (a AssertableString) HasSizeLessThan(substring string) AssertableString
HasSizeLessThan asserts if the assertable string's length is less than the size of the given string It errors the test if they don't have the same size.
func (AssertableString) HasSizeLessThanOrEqualTo ¶ added in v0.0.8
func (a AssertableString) HasSizeLessThanOrEqualTo(substring string) AssertableString
HasSizeLessThanOrEqualTo asserts if the assertable string's length is less than or equal to the size of the given string It errors the test if they don't have the same size.
func (AssertableString) IsEmpty ¶
func (a AssertableString) IsEmpty() AssertableString
IsEmpty asserts if the expected string is empty It errors the tests if the string is not empty.
func (AssertableString) IsEqualTo ¶
func (a AssertableString) IsEqualTo(expected interface{}) AssertableString
IsEqualTo asserts if the expected string is equal to the assertable string value It errors the tests if the compared values (actual VS expected) are not equal.
func (AssertableString) IsLowerCase ¶ added in v0.0.5
func (a AssertableString) IsLowerCase() AssertableString
IsLowerCase asserts if the expected string is lower case It errors the tests if the string is not lower case.
func (AssertableString) IsNotEmpty ¶
func (a AssertableString) IsNotEmpty() AssertableString
IsNotEmpty asserts if the expected string is not empty It errors the tests if the string is empty.
func (AssertableString) IsNotEqualTo ¶
func (a AssertableString) IsNotEqualTo(expected interface{}) AssertableString
IsNotEqualTo asserts if the expected string is not equal to the assertable string value It errors the tests if the compared values (actual VS expected) are equal.
func (AssertableString) IsSubstringOf ¶ added in v0.0.8
func (a AssertableString) IsSubstringOf(someString string) AssertableString
IsSubstringOf asserts if the assertable string is a substring of the given element It errors the test if it does not contain it.
func (AssertableString) IsUpperCase ¶ added in v0.0.5
func (a AssertableString) IsUpperCase() AssertableString
IsUpperCase asserts if the expected string is upper case It errors the tests if the string is not upper case.
func (AssertableString) StartsWith ¶ added in v0.0.3
func (a AssertableString) StartsWith(substring string) AssertableString
StartsWith asserts if the assertable string starts with the given substring It errors the test if it doesn't start with the given substring.
type AssertableStruct ¶
type AssertableStruct struct {
// contains filtered or unexported fields
}
AssertableStruct is the implementation of AssertableAny for structs.
func ThatStruct ¶
func ThatStruct(t *testing.T, actual interface{}) AssertableStruct
ThatStruct returns a proper assertable structure based on the slice type.
func (AssertableStruct) ExcludingFields ¶
func (s AssertableStruct) ExcludingFields(fields ...string) AssertableStruct
ExcludingFields excludes the given fields from struct comparisons.
func (AssertableStruct) IsEqualTo ¶
func (s AssertableStruct) IsEqualTo(expected interface{}) AssertableStruct
IsEqualTo asserts if the expected structure is equal to the assertable structure value It errors the tests if the compared values (actual VS expected) are not equal.
func (AssertableStruct) IsNotEqualTo ¶
func (s AssertableStruct) IsNotEqualTo(expected interface{}) AssertableStruct
IsNotEqualTo asserts if the expected structure is not equal to the assertable structure value It errors the tests if the compared values (actual VS expected) are equal.
type AssertableTime ¶ added in v0.0.3
type AssertableTime struct {
// contains filtered or unexported fields
}
AssertableTime is the assertable structure for time.Time values.
func ThatTime ¶ added in v0.0.3
func ThatTime(t *testing.T, actual time.Time) AssertableTime
ThatTime returns an AssertableTime structure initialized with the test reference and the actual value to assert.
func (AssertableTime) IsAfter ¶ added in v0.0.3
func (a AssertableTime) IsAfter(expected time.Time) AssertableTime
IsAfter asserts if the assertable time.Time value is after the expected value It errors the tests if is not later.
func (AssertableTime) IsAlmostSameAs ¶ added in v0.0.6
func (a AssertableTime) IsAlmostSameAs(expected time.Time) AssertableTime
IsAlmostSameAs asserts if the expected time.Time is almost equal to the assertable time.Time value It errors the tests if the compared values (actual VS expected) are not equal.
func (AssertableTime) IsBefore ¶ added in v0.0.3
func (a AssertableTime) IsBefore(expected time.Time) AssertableTime
IsBefore asserts if the assertable time.Time value is before the expected value It errors the tests if is not greater.
func (AssertableTime) IsDefined ¶ added in v0.0.6
func (a AssertableTime) IsDefined() AssertableTime
IsDefined asserts if the expected time.Time is defined. It errors the tests if the value is not defined.
func (AssertableTime) IsNotDefined ¶ added in v0.0.6
func (a AssertableTime) IsNotDefined() AssertableTime
IsNotDefined asserts if the expected time.Time is not defined. It errors the tests if the value is defined.
func (AssertableTime) IsNotTheSameAs ¶ added in v0.0.3
func (a AssertableTime) IsNotTheSameAs(expected time.Time) AssertableTime
IsNotTheSameAs asserts if the expected time.Time is not equal to the assertable time.Time value It errors the tests if the compared values (actual VS expected) are equal.
func (AssertableTime) IsSameAs ¶ added in v0.0.3
func (a AssertableTime) IsSameAs(expected time.Time) AssertableTime
IsSameAs asserts if the expected time.Time is equal to the assertable time.Time value It errors the tests if the compared values (actual VS expected) are not equal.
type FluentT ¶
type FluentT struct {
// contains filtered or unexported fields
}
FluentT wraps the testing.T pointer to provide a better experience to the library users.
func (FluentT) AssertThat ¶
func (t FluentT) AssertThat(actual interface{}) AssertableAny
AssertThat initializes an assertable object to be used for asserting properties of any type The things we can assert using this type are limited.
func (FluentT) AssertThatBool ¶
func (t FluentT) AssertThatBool(actual bool) AssertableBool
AssertThatBool initializes an assertable bool to be used for asserting bool properties.
func (FluentT) AssertThatDuration ¶ added in v0.0.3
func (t FluentT) AssertThatDuration(actual time.Duration) AssertableDuration
AssertThatDuration initializes an assertable time.Duration to be used for asserting time.Duration properties.
func (FluentT) AssertThatInt ¶
func (t FluentT) AssertThatInt(actual int) AssertableInt
AssertThatInt initializes an assertable int to be used for asserting int properties.
func (FluentT) AssertThatSlice ¶
func (t FluentT) AssertThatSlice(actual interface{}, opts ...SliceOpt) AssertableSlice
AssertThatSlice initializes an assertable slice to be used for asserting slice properties.
func (FluentT) AssertThatString ¶
func (t FluentT) AssertThatString(actual string, opts ...StringOpt) AssertableString
AssertThatString initializes an assertable string to be used for asserting string properties.
func (FluentT) AssertThatStruct ¶
func (t FluentT) AssertThatStruct(actual interface{}) AssertableStruct
AssertThatStruct initializes an assertable struct to be used for asserting struct properties.
func (FluentT) AssertThatTime ¶ added in v0.0.3
func (t FluentT) AssertThatTime(actual time.Time) AssertableTime
AssertThatTime initializes an assertable time.Time to be used for asserting time.Time properties.
type SliceOpt ¶
type SliceOpt func(*AssertableSlice)
SliceOpt is a configuration option to initialize an AssertableAny Slice.
func WithCustomMessage ¶
WithCustomMessage provides a custom message to be added before the assertion error message.
type StringOpt ¶ added in v0.0.3
type StringOpt func(*AssertableString)
StringOpt is a configuration option to initialize an AssertableString.
func IgnoringCase ¶ added in v0.0.3
func IgnoringCase() StringOpt
IgnoringCase sets underlying value to lower case.
func IgnoringNewLines ¶ added in v0.0.8
func IgnoringNewLines() StringOpt
IgnoringNewLines removes the new lines from the value under assertion.
func IgnoringWhiteSpaces ¶ added in v0.0.5
func IgnoringWhiteSpaces() StringOpt
IgnoringWhiteSpaces removes the whitespaces from the value under assertion.