Documentation ¶
Overview ¶
This package provindes extensions to "gopkg.in/check.v1".
The build-in checkers are defined as public variables.
ChannelEquals ¶
This checker checks two channels that if they are same(for both len() and content).
c.Assert(checkedChannel, check.JsonEquals, expectedChannel)
JsonEquals ¶
This checker checks JSON content(supports various types).
c.Assert("[3, 4, 5]", check.JsonEquals, "[3, 4, 5") c.Assert("[3, 4, 5]", check.JsonEquals, []byte("[3, 4, 5]")) c.Assert(jsonObject, check.JsonEquals, "[3, 4, 5]") c.Assert(anyObject, check.JsonEquals, "[3, 4, 5]")
Number checkers ¶
These number checkers supports comparison between numbers without enforcement on types.
For example: compares "int16(34)" and "int32(77)"
LargerThan - obtained > expected c.Assert(obtained, check.LargerThan, expected) LargerThanOrequalTo - obtained >= expected c.Assert(obtained, check.LargerThanOrEqualTo, expected) SmallerThan - obtained < expected c.Assert(obtained, check.SmallerThan, expected) SmallerThanOrequalTo - obtained <= expected c.Assert(obtained, check.SmallerThanOrEqualTo, expected)
StringContains ¶
Checks if a sub-string is contained in checked string.
c.Assert("Hello World", check.StringContains, "llo")
Time checkers ¶
The time checkers only checks value of UNIX time, the time zone is ignored.
TimeEquals - Equivalence of two values of time c.Assert(obtainedTime, TimeEquals, expectedTime) TimeBefore - The obtained one must be earlier the expected one c.Assert(obtainedTime, TimeEquals, expectedTime) TimeAfter - The obtained one must be latter the expected one c.Assert(obtainedTime, TimeEquals, expectedTime)
ViableValue ¶
This checker checks if a value is viable.
See "utils.ValueExt.IsViable()" for detail.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ChannelEquals = channelEquals(true)
This checking would check:
- The len() for both of the channels and
- Every element(be put back) in both of the channels
var JsonEquals = &checkJsonEquals{}
Checks two varialbes which could be converted to "*go-simplejson.Json"
Various types of variable are supported:
string - JSON string []byte - As JSON string io.Reader - A reader contains JSON *go-simplejson.Json
If non of above types is matched, this checker uses "encoding/json.Marshal()" to marshal the object to JSON format and performs comparison.
See "https://godoc.org/github.com/bitly/go-simplejson" for detail information of simplejson
var LargerThan = &checkForCompare{largerThan, "LargerThan", "The left value **is not** larger than right value"}
Checks if obtained > expected
var LargerThanOrEqualTo = &checkForCompare{largerThanOrEqualTo, "LargerThanOrEqual", "The left value **is not** larger than or equal to right value"}
Checks if obtained >= expected
var SmallerThan = &checkForCompare{smallerThan, "SmallerThan", "The left value **is not** larger than right value"}
Checks if obtained < expected
var SmallerThanOrEqualTo = &checkForCompare{smallerThanOrEqualTo, "SmallerThanOrEqual", "The left value **is not** larger than or equal to right value"}
Checks if obtained <= expected
var StringContains = stringContains(true)
var TimeAfter timeAfterImpl
Checks if the obtained time is after expected time(only UNIX time).
var TimeBefore timeBeforeImpl
Checks if the obtained time is before expected time(only UNIX time).
var TimeEquals timeEqualsImpl
Checks if the both of time value are equal(only UNIX time).
var ViableValue = viableValue(true)
See "utils.ValueExt.IsViable()" function
Functions ¶
func LogTestCase ¶
func LogTestCase(c *C, testCase interface{})
func TestCaseComment ¶
func TestCaseComment(index int) CommentInterface
Types ¶
This section is empty.