Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ConvertibleTo Checker = &convertibleToChecker{ &CheckerInfo{Name: "ConvertibleTo", Params: []string{"value", "sample"}}}
ConvertibleTo determines whether a value of one type can be converted to another type.
For example:
c.Check(err, ConvertibleTo, *os.PathError{})
var ErrorAs Checker = &errorAsChecker{ &CheckerInfo{Name: "ErrorAs", Params: []string{"value", "target"}}}
ErrorAs determines whether any error in a chain has a specific type, using errors.As.
For example:
var e *os.PathError c.Check(err, ErrorAs, &e) c.Check(e.Path, Equals, "/foo/bar")
var ErrorIs Checker = &errorIsChecker{ &CheckerInfo{Name: "ErrorIs", Params: []string{"value", "expected"}}}
ErrorIs determines whether any error in a chain has a specific value, using errors.Is
For example:
c.Check(err, ErrorIs, io.EOF)
var IntEqual Checker = &intChecker{ &CheckerInfo{Name: "IntEqual", Params: []string{"x", "y"}}}
IntEqual checks that x is equal to y. Both values must be an integer kind. They don't have to have the same type, although y must be representable by the type of x.
For example:
c.Check(x, IntEqual, 10)
var IntGreater Checker = &intChecker{ &CheckerInfo{Name: "IntGreater", Params: []string{"x", "y"}}}
IntGreater checks that x is greater than y. Both values must be an integer kind. They don't have to have the same type, although y must be representable by the type of x.
For example:
c.Check(x, IntGreater, 10)
var IntGreaterEqual Checker = &intChecker{ &CheckerInfo{Name: "IntGreaterEqual", Params: []string{"x", "y"}}}
IntGreaterEqual checks that x is greater than or equal to y. Both values must be an integer kind. They don't have to have the same type, although y must be representable by the type of x.
For example:
c.Check(x, IntGreaterEqual, 10)
var IntLess Checker = &intChecker{ &CheckerInfo{Name: "IntLess", Params: []string{"x", "y"}}}
IntLess checks that x is less than y. Both values must be an integer kind. They don't have to have the same type, although y must be representable by the type of x.
For example:
c.Check(x, IntLess, 10)
var IntLessEqual Checker = &intChecker{ &CheckerInfo{Name: "IntLessEqual", Params: []string{"x", "y"}}}
IntLessEqual checks that x is less than or equal to y. Both values must be an integer kind. They don't have to have the same type, although y must be representable by the type of x.
For example:
c.Check(x, IntLessEqual, 10)
var IntNotEqual Checker = &intChecker{ &CheckerInfo{Name: "IntNotEqual", Params: []string{"x", "y"}}}
IntNotEqual checks that x is not equal to y. Both values must be an integer kind. They don't have to have the same type, although y must be representable by the type of x.
For example:
c.Check(x, IntNotEqual, 10)
var IsFalse Checker = &isFalseChecker{ &CheckerInfo{Name: "IsFalse", Params: []string{"value"}}}
IsFalse determines whether a boolean value is false.
var IsTrue Checker = &isTrueChecker{ &CheckerInfo{Name: "IsTrue", Params: []string{"value"}}}
IsTrue determines whether a boolean value is true.
var LenEquals Checker = &hasLenChecker{ &CheckerInfo{Name: "LenEquals", Params: []string{"value", "n"}}, IntEqual}
LenEquals checks that the value has the specified length. This differs from check.HasLen in that it returns an error string containing the actual length if the check fails.
For example:
c.Check(value, LenEquals, 5)
var LenGreater Checker = &hasLenChecker{ &CheckerInfo{Name: "LenGreater", Params: []string{"value", "n"}}, IntGreater}
LenGreater checks that the value has a length that is greater than n.
For example:
c.Check(value, LenGreater, 5)
var LenGreaterEquals Checker = &hasLenChecker{ &CheckerInfo{Name: "LenGreaterEquals", Params: []string{"value", "n"}}, IntGreaterEqual}
LenGreaterEquals checks that the value has a length that is greater than or equal to n.
For example:
c.Check(value, LenGreaterEquals, 5)
Functions ¶
func DecodeHexString ¶
DecodeHexString decodes the supplied hex string in to a byte slice.
func DecodeHexStringT ¶
DecodeHexStringT decodes the supplied hex string in to a byte slice.
Types ¶
This section is empty.