Commit Graph

519 Commits (devslives-master)

Author SHA1 Message Date
Russ Egan 4ccf54af99 Clearer messages
- NoError prints the error message on the next line, unquoted, which makes multiline error messages much clearer.  Sample of an error message which includes a multiline stacktrace:

    Error:		Received unexpected error:
			Hi!

			/Volumes/Pouch/Users/russegan/dev/go/src/gitlab.protectv.local/ncryptify/client.git/client_test.go:27 (0x75c8c)
				TestNew: assert.NoError(merry.New("Hi!"), "with message")
			/usr/local/Cellar/go/1.7rc1/libexec/src/testing/testing.go:610 (0x70a01)
				tRunner: fn(t)
			/usr/local/Cellar/go/1.7rc1/libexec/src/runtime/asm_amd64.s:2086 (0x5d131)
				goexit: BYTE	$0x90	// NOP
	Messages:	with message

- Error,NoError,and EqualError now don’t inline the user’s extra messages.  user’s messages are printed in the “Messages:” section, as with all other assertions.
- EqualError now avoids isNil(), mirroring the changes already made to Error and NoError.
- Equal, EqualValues, and EqualError now print the expected and actual values each on a newline, aligned vertically, which makes it easier for a human to visually detect the differences.  Examples:

    Error:		Error message not equal:
            expected: ”no failure"
            recieved: “failure"
    Messages:	with message

    Error:	Not equal:
            "high" (expected)
            "low" (actual)
    Messages:	with message

- EqualValues uses the same value formatting and diff output as Equal for consistency
2016-09-25 11:15:27 -04:00
Ernesto Jiménez 69483b4bd1 Merge pull request #327 from jveski/issue-155
Clarify assert.Equal failure message given mismatched numeric types
2016-09-25 02:54:16 +01:00
Jordan Olshevski d2b5f58808 Add formatUnequalValues struct test coverage
This expands the TestFormatUnequalValues test case to cover the behavior
of the function when provided two struct type'd values.
2016-09-24 17:22:54 -07:00
Jordan Olshevski a34cbb254a Use switch statement instead of numericTypes map 2016-09-24 17:19:37 -07:00
Jordan Olshevski c48fed3351 Use %s instead of %v when printing inequal values
Since the values are already strings, there is no reason to use %v.
2016-09-24 17:17:28 -07:00
Ernesto Jiménez 0858597361 mock spew config in init 2016-09-24 21:05:08 +01:00
Ernesto Jiménez 20e531e07d Merge pull request #357 from stretchr/issue-330
Namespace suite flag `m` to `testify.m`
2016-09-24 20:49:34 +01:00
Ernesto Jiménez bfe70f3776 Namespace suite flag `m` to `testify.m` 2016-09-24 19:52:00 +01:00
Ernesto Jiménez dfaf6b82bc Merge pull request #335 from dominicbarnes/mock-arg-diff
Mock: Add diff to output when no exact match found
2016-09-24 19:44:49 +01:00
Ernesto Jiménez f8bf943ef4 Merge pull request #355 from stretchr/issue-342
AssertExpectationsForObjects takes *Mock
2016-09-24 19:19:23 +01:00
Ernesto Jiménez cee58fce5d Merge pull request #354 from stretchr/issue-348
Fixes #348 - Update go-spew
2016-09-24 18:05:41 +01:00
Ernesto Jiménez 92787b8c71 Fixes #342 - AssertExpectationsForObjects takes *Mock 2016-09-24 18:04:24 +01:00
Ernesto Jiménez 57c58873ea Fixes #348 - Update go-spew 2016-09-24 17:17:34 +01:00
Ernesto Jiménez 63b388178e Merge pull request #320 from mhamrle/fix_messages
fix assertion message formatting
2016-09-24 16:14:04 +01:00
Ernesto Jiménez 45bd08b0da Merge pull request #321 from mhamrle/spell
fix typos
2016-09-24 16:06:34 +01:00
Ernesto Jiménez 2f3f464ae5 Merge pull request #338 from nyarly/error_format
Changing format of NoError output to make use of errors
2016-09-24 15:05:22 +01:00
Ernesto Jiménez c13a3217b3 Merge pull request #344 from mrbroll/diff-data-race
Fix #347 - Diff data race
2016-09-24 14:56:45 +01:00
Ernesto Jiménez e8f403bbeb Merge pull request #343 from adamwg/fix-341
Fix #341
2016-09-24 14:51:00 +01:00
Ernesto Jiménez c1ef1566a6 Merge pull request #352 from philtay/master
Test against Go 1.7
2016-09-24 14:48:03 +01:00
philtay 26322e8ae1 Add Go 1.7 2016-09-22 20:22:41 +02:00
Michael Broll f6ca157360 assert: set spew config members in init() to prevent data race detection 2016-09-06 17:16:12 -07:00
Michael Broll 3656ffd69b write test to simulate parallel execution of diff() 2016-09-06 17:15:19 -07:00
Adam Wolfe Gordon 72961116a1 Fix #341
Go 1.7 subtests are called directly from testing.tRunner, not from the
test that contains the t.Run call. Because of this, the call stack
doesn't contain a function starting with Test, Benchmark, or Example,
causing assert.CallerInfo() to run off the end of the call stack and
return nil.

Look for testing.tRunner explicitly to solve this problem, and return
the list of callers if we do run off the call stack so that if there's a
similar problem in the future we still get an inflated stack trace
rather than no trace at all.
2016-09-06 16:06:25 -06:00
Judson fc28fc9f86
Changing format of NoError output to make use of errors 2016-08-19 11:10:36 -07:00
Dominic Barnes 6a1a0a4608 add arguments diffing 2016-08-11 17:12:24 -07:00
Jordan Olshevski 3bfb674961 Print types in failed numeric equality assertions
This addresses vague and misleading output when asserting on the
equality of two values of differing numeric types.

Example: assert.Equal(t, int64(123), int32(123))

Previously, the user would have received a vague message claiming that
123 != 123. Now the message will read "int64(123) != int32(123)".
2016-07-06 18:38:55 -07:00
Martin Hamrle e704e18cb5 fix typos 2016-06-30 19:23:22 +02:00
Martin Hamrle a55764f5c1 fix assertion message formatting
Fail and HTTPBodyNotContains expected that Fail formats messages.
2016-06-30 19:17:32 +02:00
Esdras Beleza bf7a93e70c Add timestamp 2016-06-26 18:36:07 -03:00
Esdras Beleza fcedfe2aad Add callbacks to run before and after each test 2016-06-26 18:35:37 -03:00
Ernesto Jiménez d77da356e5 Fixes #311 - Detect empty interface error gotcha 2016-06-15 11:28:44 +02:00
Mat Ryer 8d64eb7173 added godoc badge 2016-05-25 00:42:29 +01:00
Mat Ryer 91bf5023ce added Go report card 2016-05-25 00:41:42 +01:00
Ernesto Jiménez 6cb3b85ef5 Merge pull request #304 from coxx/fix-typo
Fix several typos
2016-05-04 14:01:55 +01:00
Konstantin Cherkasov e9777bfbf1 Fix typo: preceeded -> preceded 2016-05-04 10:20:41 +03:00
Konstantin Cherkasov 48c93141f0 Fix typo: underyling -> underlying 2016-05-04 10:17:29 +03:00
Konstantin Cherkasov b72b9c302b Fix typo: arugment -> argument 2016-05-04 09:50:41 +03:00
Ernesto Jiménez c5d7a69bf8 Fixes #300 - Fix backwards-incompatible change 2016-04-18 23:58:27 +01:00
Ernesto Jiménez bcd9e3389d Merge pull request #294 from stretchr/issue-293
Fixing isse #293
2016-04-13 10:04:24 +01:00
Ernesto Jiménez 3058ec34fb Document chances of false reults on mock asserts 2016-04-12 21:41:11 +01:00
Ernesto Jiménez 096a13e3a4 Fix #293 - Fix mock.AssertExpectations w/ pointers
AssertExpectations did fail using an argument pointer whose underlying
value changed before the assertion.
2016-04-12 21:25:54 +01:00
Ernesto Jiménez 0744955171 Merge pull request #291 from willogden/master
Update MatchedBy example to include actual use of MatchedBy!
2016-04-07 14:01:23 +01:00
Will Ogden 17400e7672 Update MatchedBy example to include actual use of MatchedBy! 2016-04-07 11:11:40 +01:00
Ernesto Jiménez 6fe211e493 Merge pull request #284 from AlekSi/master
Update vendored go-spew to fix crash on OS X.
2016-03-05 16:54:46 +00:00
Alexey Palazhchenko 521c4b6818 Update vendored go-spew to fix crash on OS X.
https://github.com/AlekSi/0xb01dfacedebac1e
https://github.com/golang/go/issues/14631
2016-03-05 14:16:52 +03:00
Ernesto Jiménez 1f4a1643a5 Merge pull request #277 from philtay/master
Add Go 1.6 and use container-based infrastructure
2016-02-21 10:44:43 +00:00
philtay 886c762fe2 Add Go 1.6 and use container-based infrastructure 2016-02-20 19:20:47 +01:00
Ernesto Jiménez 9f9027faeb Merge pull request #270 from november-eleven/master
Fix a typo
2016-01-29 19:31:06 +00:00
Thomas LE ROUX dcb39ac4d8 docs: Fix a typo 2016-01-29 17:29:26 +01:00
Ernesto Jiménez f390dcf405 Merge pull request #266 from ernesto-jimenez/golint
Fix golint warnings
2016-01-09 21:38:47 +01:00