142 Commits

Author SHA1 Message Date
Will Faught
8512261d41 Add Zero and NotZero assertions and requirements
Zero returns true if the value equals the value's type's zero value.

NotZero returns the opposite of Zero.
2015-08-24 15:53:36 -07:00
Ernesto Jiménez
ddcad49ec6 Fix typo in test function name 2015-06-15 21:31:24 +01:00
Ernesto Jiménez
abc938a12b Add test to avoid regression of issue #180 2015-06-14 19:29:18 +01:00
Daniel Perez
1e710e53ab Support map keys for Contains/NotContains assertion. 2015-05-13 16:07:31 +09:00
Michael R. Maletich
4e2053a4af Address #162: InDelta should fail when actual value is not a number.
Comparting a float with NaN is always false so the assertion would always pass.
Added a check that either the actual or expected values are NaN.

InDelta will now fail if either the actual or expected value are NaN.
2015-05-12 11:54:42 +00:00
Davide D'Agostino
3b361f7ebb Merge pull request #134 from lazywei/master
Add InDeltaSlice.
2015-04-18 12:10:15 -07:00
Chih-Wei Chang
8b75665fbf Add InEpsilonSlice and corresponding testing. 2015-04-18 22:40:21 +08:00
Tyler Bunnell
4f9c9aeeaa Don't handle func comparisons 2015-04-16 11:41:42 -06:00
Paul Querna
e73f5c7e39 Add assert.EqualValues, which attempts to convert types to test equality. Fixes #129 2015-02-10 16:56:43 -08:00
Arnaud Porterie
9bab92ede2 Exclude conversions from equality tests
`ObjectsAreEqual` using `ConvertibleTo` causes the `ObjectsAreEqual`
function to be asymmetrical and producing incorrect assertions.

Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
2015-02-06 16:08:28 -08:00
Tyler
2eaa4b48b8 Merge pull request #110 from cryptix/master
added tests from PR #103
2014-12-22 10:16:26 -07:00
Tyler Bunnell
d1472b75d1 fix merge conflict 2014-12-22 10:15:32 -07:00
Henry
7a9121a162 added tests from PR #103 2014-12-17 16:41:45 +01:00
Neil Conway
38aecdc957 Fix panic when comparing unequal maps.
The change in #94 resulted in using == to compare two values that might not be
comparable. Hence, this resulted in a panic for situations like:

    ObjectsAreEqual(map[int]int{5: 10}, map[int]int{10: 20})

The fix is to use reflect.DeepEqual() instead.
2014-11-24 16:11:51 -08:00
Victor Kryukov
d3556349dd Fix #99: Contains doesn't work for complex types 2014-11-18 15:26:31 -08:00
Victor Kryukov
b64f0d0b59 Implement Regexp and NotRegexp 2014-09-13 13:13:42 -06:00
Tyler
15dabc1a45 Merge pull request #73 from comogo/includes
Allow Contains and NotContains to check slices and arrays
2014-09-09 20:31:58 -06:00
Victor
0f9ba46361 Minor doc string update 2014-08-28 13:05:46 -07:00
Victor Kryukov
5461242ffd Increase assert test coverage from 86.6% to 97.1%, fixed bugs.
Extend tests for NotEqual, Len and add tests for Condition, InEpsilon.
Add tests for Assertion.Condition, Assertion.InEpsilon, Assertion.InDelta
Fix a bug for Assertion.InDelta, Assertion.InEpsilon having incorrect signature.
2014-08-28 12:56:51 -07:00
Mateus Lorandi dos Santos
ab1fdba54e Allow Contains and NotContains to check slices and arrays 2014-08-21 11:13:02 -03:00
OMOTO Kenji
e787d6aa9d Add Len() 2014-07-17 18:39:50 +09:00
bhenderson
3b602c6e81 Add InDelta() for comparing floats. 2014-07-10 08:49:17 -07:00
Tyler Bunnell
5cc789b89e Clean up golint warnings 2014-06-18 09:28:16 -06:00
Tyler Bunnell
d951608d14 Add test for empty ints 2014-06-18 09:20:40 -06:00
James Bowes
21382c1202 Attempt type conversion in assert.Equal
If the two values being tested are of compatible types, convert one
value to the other's type before comparing them. This allows
`assert.Equal(int64(123), uint64(123))` to pass.
2014-06-03 19:01:48 -03:00
Tyler Bunnell
d3d427864d Fix merge conflict 2014-04-22 10:01:40 -06:00
mreedell
2c7459d4ba Fixing issue 33 2014-04-14 15:24:44 -04:00
Guncha
5114cbfc4a Fix #45: assert.Empty should work with channels 2014-03-31 19:10:48 -04:00
Steve Leonard
e763434382 rename to EqualError 2014-02-15 15:06:23 -05:00
Steve Leonard
92af479c56 ExactError, asserts that err is not nil and its string matches 2014-02-15 12:24:39 -05:00
Chakrit Wichian
f51780437f Make isEmpty() properly handles maps. [fix #34] 2014-01-19 10:30:16 +07:00
Victor Blomqvist
a1964c1081 expanded test for WithinDuration to test for negative durations 2013-09-12 13:53:27 +08:00
Victor Blomqvist
ed409be48c expanded test for WithinDuration to test for both |a-b|>=dt and |b-a|>=dt 2013-09-12 13:37:44 +08:00
Victor Blomqvist
0378c681e8 added new assert WithinDuration 2013-09-12 13:24:50 +08:00
Mat Ryer
8cb5e40869 made Exactly not panic on nils 2013-07-18 09:42:16 -06:00
Mat Ryer
3e51f38eaf added Fail and Exactly assertions 2013-07-17 12:15:39 -06:00
Mat Ryer
841b040dd7 Revert "Fixes #13"
This reverts commit 9b28fe8965cd21633adaf91ee714e93532b0ec6e.
2012-12-04 13:11:45 -07:00
Mat Ryer
9b28fe8965 Fixes #13 2012-11-21 22:25:09 +00:00
Mat Ryer
03751c9109 Fixes #6 - added Empty and NotEmpty alternatives to nil 2012-11-21 15:03:46 +00:00
Mat Ryer
a58329b4c5 Fixes #8 2012-11-21 14:42:06 +00:00
Tyler Bunnell
4a0996d790 Make the output pretty! 2012-10-17 07:51:19 -06:00
Tyler Bunnell
2930d903bf Initial Commit 2012-10-16 11:14:23 -06:00