Documentation ¶
Index ¶
- func ShouldAlmostEqual(actual interface{}, expected ...interface{}) error
- func ShouldBeBetween(actual interface{}, expected ...interface{}) error
- func ShouldBeBetweenOrEqual(actual interface{}, expected ...interface{}) error
- func ShouldBeBlank(actual interface{}, expected ...interface{}) error
- func ShouldBeEmpty(actual interface{}, expected ...interface{}) error
- func ShouldBeFalse(actual interface{}, expected ...interface{}) error
- func ShouldBeGreaterThan(actual interface{}, expected ...interface{}) error
- func ShouldBeGreaterThanOrEqualTo(actual interface{}, expected ...interface{}) error
- func ShouldBeIn(actual interface{}, expected ...interface{}) error
- func ShouldBeLessThan(actual interface{}, expected ...interface{}) error
- func ShouldBeLessThanOrEqualTo(actual interface{}, expected ...interface{}) error
- func ShouldBeNil(actual interface{}, expected ...interface{}) error
- func ShouldBeTrue(actual interface{}, expected ...interface{}) error
- func ShouldBeZeroValue(actual interface{}, expected ...interface{}) error
- func ShouldContain(actual interface{}, expected ...interface{}) error
- func ShouldContainKey(actual interface{}, expected ...interface{}) error
- func ShouldContainSubstring(actual interface{}, expected ...interface{}) error
- func ShouldEndWith(actual interface{}, expected ...interface{}) error
- func ShouldEqual(actual interface{}, expected ...interface{}) error
- func ShouldEqualTrimSpace(actual interface{}, expected ...interface{}) error
- func ShouldHappenAfter(actual interface{}, expected ...interface{}) error
- func ShouldHappenBefore(actual interface{}, expected ...interface{}) error
- func ShouldHappenBetween(actual interface{}, expected ...interface{}) error
- func ShouldHappenOnOrAfter(actual interface{}, expected ...interface{}) error
- func ShouldHappenOnOrBefore(actual interface{}, expected ...interface{}) error
- func ShouldHaveLength(actual interface{}, expected ...interface{}) error
- func ShouldNotAlmostEqual(actual interface{}, expected ...interface{}) error
- func ShouldNotBeBetween(actual interface{}, expected ...interface{}) error
- func ShouldNotBeBetweenOrEqual(actual interface{}, expected ...interface{}) error
- func ShouldNotBeBlank(actual interface{}, expected ...interface{}) error
- func ShouldNotBeEmpty(actual interface{}, expected ...interface{}) error
- func ShouldNotBeIn(actual interface{}, expected ...interface{}) error
- func ShouldNotBeNil(actual interface{}, expected ...interface{}) error
- func ShouldNotContain(actual interface{}, expected ...interface{}) error
- func ShouldNotContainKey(actual interface{}, expected ...interface{}) error
- func ShouldNotContainSubstring(actual interface{}, expected ...interface{}) error
- func ShouldNotEndWith(actual interface{}, expected ...interface{}) error
- func ShouldNotEqual(actual interface{}, expected ...interface{}) error
- func ShouldNotExist(actual interface{}, expected ...interface{}) error
- func ShouldNotStartWith(actual interface{}, expected ...interface{}) error
- func ShouldStartWith(actual interface{}, expected ...interface{}) error
- type AssertFunc
- type AssertionError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ShouldAlmostEqual ¶
func ShouldAlmostEqual(actual interface{}, expected ...interface{}) error
ShouldAlmostEqual makes sure that two parameters are close enough to being equal. The acceptable delta may be specified with a third argument.
func ShouldBeBetween ¶
func ShouldBeBetween(actual interface{}, expected ...interface{}) error
ShouldBeBetween receives exactly two parameters and ensures that the first is less than the second.
func ShouldBeBetweenOrEqual ¶
func ShouldBeBetweenOrEqual(actual interface{}, expected ...interface{}) error
ShouldBeBetweenOrEqual receives exactly three parameters: an actual value, a lower bound, and an upper bound. It ensures that the actual value is between both bounds or equal to one of them.
func ShouldBeBlank ¶
func ShouldBeBlank(actual interface{}, expected ...interface{}) error
ShouldBeBlank receives exactly 1 string parameter and ensures that it is equal to "".
func ShouldBeEmpty ¶
func ShouldBeEmpty(actual interface{}, expected ...interface{}) error
ShouldBeEmpty receives a single parameter (actual) and determines whether or not calling len(actual) would return `0`.
func ShouldBeFalse ¶
func ShouldBeFalse(actual interface{}, expected ...interface{}) error
ShouldBeFalse receives a single parameter and ensures that it is false.
func ShouldBeGreaterThan ¶
func ShouldBeGreaterThan(actual interface{}, expected ...interface{}) error
ShouldBeGreaterThan receives exactly two parameters and ensures that the first is greater than the second.
func ShouldBeGreaterThanOrEqualTo ¶
func ShouldBeGreaterThanOrEqualTo(actual interface{}, expected ...interface{}) error
ShouldBeGreaterThanOrEqualTo receives exactly two parameters and ensures that the first is greater than or equal to the second.
func ShouldBeIn ¶
func ShouldBeIn(actual interface{}, expected ...interface{}) error
ShouldBeIn receives at least 2 parameters. The first is a proposed member of the collection that is passed in either as the second parameter, or of the collection that is comprised of all the remaining parameters. This assertion ensures that the proposed member is in the collection (using ShouldEqual).
Example of testsuite file:
name: Assertions testsuite testcases: - name: ShouldBeIn steps: - script: echo 1 assertions: - result.systemoutjson ShouldBeIn 1 2
func ShouldBeLessThan ¶
func ShouldBeLessThan(actual interface{}, expected ...interface{}) error
ShouldBeLessThan receives exactly two parameters and ensures that the first is less than the second.
func ShouldBeLessThanOrEqualTo ¶
func ShouldBeLessThanOrEqualTo(actual interface{}, expected ...interface{}) error
ShouldBeLessThanOrEqualTo receives exactly two parameters and ensures that the first is less than or equal to the second.
func ShouldBeNil ¶
func ShouldBeNil(actual interface{}, expected ...interface{}) error
ShouldBeNil receives a single parameter and ensures that it is nil.
func ShouldBeTrue ¶
func ShouldBeTrue(actual interface{}, expected ...interface{}) error
ShouldBeTrue receives a single parameter and ensures that it is true.
func ShouldBeZeroValue ¶
func ShouldBeZeroValue(actual interface{}, expected ...interface{}) error
ShouldBeZeroValue receives a single parameter and ensures that it is the Go equivalent of the default value, or "zero" value.
func ShouldContain ¶
func ShouldContain(actual interface{}, expected ...interface{}) error
ShouldContain receives exactly two parameters. The first is a slice or a single value and the second is a proposed member. Membership is determined using ShouldEqual.
func ShouldContainKey ¶
func ShouldContainKey(actual interface{}, expected ...interface{}) error
ShouldContainKey receives exactly two parameters. The first is a map and the second is a proposed key.
func ShouldContainSubstring ¶
func ShouldContainSubstring(actual interface{}, expected ...interface{}) error
ShouldContainSubstring receives exactly 2 string parameters and ensures that the first contains the second as a substring.
func ShouldEndWith ¶
func ShouldEndWith(actual interface{}, expected ...interface{}) error
ShouldEndWith receives exactly 2 string parameters and ensures that the first ends with the second.
func ShouldEqual ¶
func ShouldEqual(actual interface{}, expected ...interface{}) error
ShouldEqual receives exactly two parameters and does an equality check.
Example of testsuite file:
name: Assertions testsuite testcases: - name: test assertion steps: - script: echo 'foo' assertions: - result.code ShouldEqual 0
func ShouldEqualTrimSpace ¶
func ShouldEqualTrimSpace(actual interface{}, expected ...interface{}) error
ShouldEqualTrimSpace receives exactly 2 string parameters and ensures that the first is equal to the second after removing all leading and trailing whitespace using strings.TrimSpace(first).
func ShouldHappenAfter ¶
func ShouldHappenAfter(actual interface{}, expected ...interface{}) error
ShouldHappenAfter receives exactly 2 time.Time arguments and asserts that the first happens after the second. The arguments have to respect the date format RFC3339, as 2006-01-02T15:04:00+07:00
Example of testsuite file:
name: test ShouldHappenAfter vars: time_with_5s_before: 2006-01-02T15:04:00+07:00 time: 2006-01-02T15:04:05+07:00 testcases: - name: test assertion steps: - type: exec script: "echo {{.time}}" assertions: - result.systemout ShouldHappenAfter "{{.time_with_5s_before}}"
func ShouldHappenBefore ¶
func ShouldHappenBefore(actual interface{}, expected ...interface{}) error
ShouldHappenBefore receives exactly 2 time.Time arguments and asserts that the first happens before the second. The arguments have to respect the date format RFC3339, as 2006-01-02T15:04:00+07:00
Example of testsuite file:
name: test ShouldHappenBefore vars: time: 2006-01-02T15:04:05+07:00 time_with_5s_after: 2006-01-02T15:04:10+07:00 testcases: - name: test assertion steps: - type: exec script: "echo {{.time}}" assertions: - result.systemout ShouldHappenBefore "{{.time_with_5s_after}}"
func ShouldHappenBetween ¶
func ShouldHappenBetween(actual interface{}, expected ...interface{}) error
ShouldHappenBetween receives exactly 3 time.Time arguments and asserts that the first happens between (not on) the second and third. The arguments have to respect the date format RFC3339, as 2006-01-02T15:04:00+07:00
Example of testsuite file:
name: test ShouldHappenBetween vars: time_with_5s_before: 2006-01-02T15:04:00+07:00 time: 2006-01-02T15:04:05+07:00 time_with_5s_after: 2006-01-02T15:04:10+07:00 testcases: - name: test assertion steps: - type: exec script: "echo {{.time}}" assertions: - result.systemout ShouldHappenBetween "{{.time_with_5s_before}}" "{{.time_with_5s_after}}"
func ShouldHappenOnOrAfter ¶
func ShouldHappenOnOrAfter(actual interface{}, expected ...interface{}) error
ShouldHappenOnOrAfter receives exactly 2 time.Time arguments and asserts that the first happens on or after the second. The arguments have to respect the date format RFC3339, as 2006-01-02T15:04:00+07:00
Example of testsuite file:
name: test ShouldHappenOnOrAfter vars: time_with_5s_before: 2006-01-02T15:04:00+07:00 time: 2006-01-02T15:04:05+07:00 testcases: - name: test assertion steps: - type: exec script: "echo {{.time}}" assertions: - result.systemout ShouldHappenOnOrAfter "{{.time_with_5s_before}}"
func ShouldHappenOnOrBefore ¶
func ShouldHappenOnOrBefore(actual interface{}, expected ...interface{}) error
ShouldHappenOnOrBefore receives exactly 2 time.Time arguments and asserts that the first happens on or before the second. The arguments have to respect the date format RFC3339, as 2006-01-02T15:04:00+07:00
Example of testsuite file:
name: test ShouldHappenOnOrBefore vars: time: 2006-01-02T15:04:05+07:00 time_with_5s_after: 2006-01-02T15:04:10+07:00 testcases: - name: test assertion steps: - type: exec script: "echo {{.time}}" assertions: - result.systemout ShouldHappenOnOrBefore "{{.time_with_5s_after}}"
func ShouldHaveLength ¶
func ShouldHaveLength(actual interface{}, expected ...interface{}) error
ShouldHaveLength receives 2 parameters. The first is a collection to check the length of, the second being the expected length.
func ShouldNotAlmostEqual ¶
func ShouldNotAlmostEqual(actual interface{}, expected ...interface{}) error
ShouldNotAlmostEqual makes sure that two parameters are not close enough to being equal. The unacceptable delta may be specified with a third argument.
func ShouldNotBeBetween ¶
func ShouldNotBeBetween(actual interface{}, expected ...interface{}) error
ShouldNotBeBetween receives exactly three parameters: an actual value, a lower bound, and an upper bound. It ensures that the actual value is NOT between both bounds.
func ShouldNotBeBetweenOrEqual ¶
func ShouldNotBeBetweenOrEqual(actual interface{}, expected ...interface{}) error
ShouldNotBeBetweenOrEqual receives exactly three parameters: an actual value, a lower bound, and an upper bound. It ensures that the actual value is nopt between the bounds nor equal to either of them.
func ShouldNotBeBlank ¶
func ShouldNotBeBlank(actual interface{}, expected ...interface{}) error
ShouldNotBeBlank receives exactly 1 string parameter and ensures that it is equal to "".
func ShouldNotBeEmpty ¶
func ShouldNotBeEmpty(actual interface{}, expected ...interface{}) error
ShouldNotBeEmpty receives a single parameter (actual) and determines whether or not calling len(actual) would return a value greater than zero.
func ShouldNotBeIn ¶
func ShouldNotBeIn(actual interface{}, expected ...interface{}) error
ShouldNotBeIn receives at least 2 parameters. The first is a proposed member of the collection that is passed in either as the second parameter, or of the collection that is comprised of all the remaining parameters. This assertion ensures that the proposed member is NOT in the collection (using ShouldEqual).
Example of testsuite file:
name: Assertions testsuite testcases: - name: ShouldNotBeIn steps: - script: echo 3 assertions: - result.systemoutjson ShouldNotBeIn 1 2
func ShouldNotBeNil ¶
func ShouldNotBeNil(actual interface{}, expected ...interface{}) error
ShouldNotBeNil receives a single parameter and ensures that it is not nil.
func ShouldNotContain ¶
func ShouldNotContain(actual interface{}, expected ...interface{}) error
ShouldNotContain receives exactly two parameters. The first is a slice and the second is a proposed member. Membership is determinied using ShouldEqual.
func ShouldNotContainKey ¶
func ShouldNotContainKey(actual interface{}, expected ...interface{}) error
ShouldNotContainKey receives exactly two parameters. The first is a map and the second is a proposed absent key.
func ShouldNotContainSubstring ¶
func ShouldNotContainSubstring(actual interface{}, expected ...interface{}) error
ShouldNotContainSubstring receives exactly 2 string parameters and ensures that the first does NOT contain the second as a substring.
func ShouldNotEndWith ¶
func ShouldNotEndWith(actual interface{}, expected ...interface{}) error
ShouldNotEndWith receives exactly 2 string parameters and ensures that the first does not end with the second.
func ShouldNotEqual ¶
func ShouldNotEqual(actual interface{}, expected ...interface{}) error
ShouldNotEqual receives exactly two parameters and does an inequality check.
func ShouldNotExist ¶
func ShouldNotExist(actual interface{}, expected ...interface{}) error
ShouldNotExist receives a single parameter and ensures that it is nil, blank or zero value
func ShouldNotStartWith ¶
func ShouldNotStartWith(actual interface{}, expected ...interface{}) error
ShouldNotStartWith receives exactly 2 string parameters and ensures that the first does not start with the second.
func ShouldStartWith ¶
func ShouldStartWith(actual interface{}, expected ...interface{}) error
ShouldStartWith receives exactly 2 string parameters and ensures that the first starts with the second.
Types ¶
type AssertFunc ¶
type AssertFunc func(actual interface{}, expected ...interface{}) error
func Get ¶
func Get(s string) (AssertFunc, bool)
type AssertionError ¶
type AssertionError struct {
// contains filtered or unexported fields
}
func (*AssertionError) Error ¶
func (e *AssertionError) Error() string