Commit Graph

878 Commits (assert-simplify-isNil)

Author SHA1 Message Date
Angel_Kitty 581db3dfa7 Update License file copyright year 2020-04-07 15:16:17 +02:00
Angel_Kitty 2c1f261278 Update License file copyright year 2020-04-07 15:16:17 +02:00
Martijn bb468cc94d Remove unneeded return statements 2020-04-06 07:42:56 +10:00
Martijn 28b7455875 Ran go generate ./... 2020-04-06 07:42:56 +10:00
Martijn e0afeb10e3 Fix whitespace issues 2020-04-06 07:42:56 +10:00
Martijn 1454493cee Add test for HTTPStatusCode
For purposes of the test, status code 101 is checked as this does not overlap with the other assertions. (HTTPSuccess, HTTPRedirect and HTTPError)
2020-04-06 07:42:56 +10:00
Martijn f0828adbb3 Add HTTPStatusCode assertion
Allows for asserting a specific HTTP status code was returned instead of a general success, error or redirect assertion.
2020-04-06 07:42:56 +10:00
hectorj 012967472b Make InEpsilon fail when given a NaN
fixes #918
2020-04-02 22:34:25 +11:00
YukinoKamei dfba5a4e3a add ) 2020-03-30 15:55:14 +11:00
Martin Sucha f6cbfc0d03 Print more details in ElementsMatch
It is not very helpful to print that the lengths differ when an
assertion fails, since that does not reveal what the cause of the issue
might be.

Let's print which elements are extra in each list, that should convey
the relevant information to the user. Also use spew to format the
objects, similar to what Equal does, to make the output more readable.
2020-03-14 21:17:20 +11:00
Esdras Beleza de Noronha 961bfee4b1 Add function to return if all tests in a suite passed 2020-03-11 19:42:32 +11:00
Esdras Beleza de Noronha f37e428318 Use comma ok idiom 2020-03-11 19:42:32 +11:00
Esdras Beleza de Noronha 89909913cc Fix var block with only one variable 2020-03-11 19:42:32 +11:00
Esdras Beleza de Noronha 9feda7c901 Change imports for consistency 2020-03-11 19:42:32 +11:00
Esdras Beleza de Noronha fdf3f01101 Update documentation 2020-03-11 19:42:32 +11:00
Esdras Beleza e8910bb335 Add stats to suites and tests 2020-03-11 19:42:32 +11:00
Henry Blyth cb23521296 Test verbose Contains Fail message
If asserting an error contained in a string, includeElement will fail
but Contains will confusingly print both values as strings, which can
look like a testify problem instead of an assertion failure.
2020-03-10 08:59:40 +11:00
Jordan Christiansen c12dcedf28 Include the type in assert.Contains error messages
Fixes #828
2020-03-10 08:59:40 +11:00
alexpantyukhin 6be346c1f1 rename order files to compare files 2020-03-09 08:00:09 +11:00
Alexander Pantyukhin 9388656beb fix language 2020-03-06 19:44:08 +11:00
Alexander Pantyukhin 2ca25e3fac fix for assertions 2020-03-06 19:44:08 +11:00
Alexander Pantyukhin ec73f449b3 add new tests 2020-03-06 19:44:08 +11:00
Alexander Pantyukhin 0b4ff03cda update assertion_order.go according review notes 2020-03-06 19:44:08 +11:00
Alexander Pantyukhin ad53dbbf0a put constants instead of values. 2020-03-06 19:44:08 +11:00
alexpantyukhin d583a38000 fix with gofmt tool 2020-03-06 19:44:08 +11:00
alexpantyukhin f4b48264a4 fix fmt 2020-03-06 19:44:08 +11:00
alexpantyukhin c106be4ce3 refactoring of assertion_order 2020-03-06 19:44:08 +11:00
Christian Muehlhaeuser 02b2656991 Handle ineffectual assignments
Removed ineffectual assignments.
2020-03-06 16:18:13 +11:00
Christian Muehlhaeuser 1c7f4ef084 Avoid unnecessary conversions
No need to convert values here.
2020-03-06 14:40:56 +11:00
Christian Muehlhaeuser 3acde138ca Format code with goimports
Fixed formatting and import order.
2020-03-06 14:39:08 +11:00
Christian Muehlhaeuser 08b5acc756 Fixed tautological errors
err can't ever be not nil here, unless the Go language specs are changing.
2020-03-06 14:38:03 +11:00
Christian Muehlhaeuser 8bb674980e Simplify code
- Direct boolean comparisons
- Don't use Sprintf when we can use the String() function
2020-03-06 14:36:53 +11:00
Christian Muehlhaeuser fbbf8a0782 Removed unused variables
Probably just became obsolete by now.
2020-03-06 14:31:21 +11:00
Christian Muehlhaeuser c5d499e514 Simplify go code
Just reads a bit nicer, in my opinion.
2020-03-06 14:30:34 +11:00
Hiram Chirino 310548cda6 fix: error diff was not being show for large values
If you were comparing values which when formatted were longer than about 64k then the actual, expected and diff messages were not printed to the console.
2020-03-04 06:47:27 +11:00
Boyan b7d60e3a8c Test go modules on and off for master builds 2020-02-28 06:47:40 -07:00
Luan Santos afd4130c14 Disable using Stringer/error interfaces for diffing
`spew`'s default formatter will call `String()` or `Error()` in structs
that implement the `fmt.Stringer` or `error` interfaces. Depending on
the implementation of those, the diff can become quite useless to read
(see the example struct I used for the test case in this commit).

This changes `spew`'s configuration to `DisableMethods` so that it will
always use it's own pretty printer. This makes testing structs less
surprising and generally more useful, without tying the tests to the
implementation of `String()` (the user here can always chose to
`require.Equal(a.String(), b.String())` if testing those is important to
them.
2020-02-26 08:50:07 -07:00
Ogoyukin 9f1c28b404 The mock.IsMethodCallable function is refactored 2020-02-26 16:09:38 +11:00
Ogoyukin 3a72ffb6d8 Refactored Test_Mock_IsMethodCallable 2020-02-26 16:09:38 +11:00
Ogoyukin 6bf5d94027 Update comment 2020-02-26 16:09:38 +11:00
Ogoyukin 4a3d527660 Refactored 'isArgsEqual' 2020-02-26 16:09:38 +11:00
Ogoyukin 36e077c09a Refactored 'IsMethodCallable' 2020-02-26 16:09:38 +11:00
Ogoyukin 42aafee8d7 Added function 'IsMethodCallable', which checking that the method can be called. 2020-02-26 16:09:38 +11:00
Boyan 3ebf1ddaeb Revert PR #867 2020-02-20 07:56:11 +11:00
Corey McGregor 624f997379 fix(suite): Add Fatalf method to suite.TestingT for gomock compatibility 2020-02-19 07:05:10 +11:00
Olaf Alders 5d2970ff94 Fix typo in CONTRIBUTING.md 2020-02-19 07:03:40 +11:00
Olaf Alders 2aadfe8adc Grammatical change in documentation for Run()
There was a switch between singular and plural which made this line a
little bit hard to parse.
2020-02-19 07:03:40 +11:00
Boyan Soubachov 55d8b5740c Add interface tests for suite.T 2020-02-06 07:41:25 +11:00
Chris K 9dfcf7c562 suite: make suite.TestingT satisfy mock.TestingT
...by adding Logf method.
2020-02-05 20:52:22 +11:00
Daniel Cormier 518a1491c7 IsType: A type-safe way of checking argument type
Like `assert.IsType(...)`, `mock.IsType` is used to check that the
type of an argument is the expected type. This is an alternative
to `AnythingOfType`.
2020-01-31 08:08:47 +11:00