Commit Graph

951 Commits (make-AssertionFunc-types-aliases)

Author SHA1 Message Date
Olivier Mengué f8f5e6bd38 assert: make *AssertionFunc type just aliases
We don't need to define "hard" types for *AssertionFunc types as we
don't attach methods to them. Also, making them just type aliases will
give more flexibility to users of our API.
So ComparisonAssertionFunc and other *AssertionFunc types are now just
type aliases.
2024-03-04 18:52:18 +01:00
Bracken bb548d0473
Merge pull request #1552 from stretchr/dependabot/go_modules/github.com/stretchr/objx-0.5.2
build(deps): bump github.com/stretchr/objx from 0.5.1 to 0.5.2
2024-02-29 14:36:18 +00:00
dependabot[bot] 814075f391
build(deps): bump github.com/stretchr/objx from 0.5.1 to 0.5.2
Bumps [github.com/stretchr/objx](https://github.com/stretchr/objx) from 0.5.1 to 0.5.2.
- [Release notes](https://github.com/stretchr/objx/releases)
- [Commits](https://github.com/stretchr/objx/compare/v0.5.1...v0.5.2)

---
updated-dependencies:
- dependency-name: github.com/stretchr/objx
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-29 11:18:15 +00:00
Bracken e045612245
Merge pull request #1339 from bogdandrutu/uintptr
Add support to compare uintptr
2024-02-28 16:20:56 +00:00
Bracken 5b6926d686
Merge pull request #1385 from hslatman/not-implements
Add `NotImplements` and variants
2024-02-28 16:02:08 +00:00
Bracken 9f97d67703
Merge pull request #1550 from stretchr/release-notes
Include the auto-release notes in releases
2024-02-28 09:53:47 +00:00
Bracken Dawson bcb0d3fe49
Include the auto-release notes in releases 2024-02-27 16:35:20 +00:00
Bracken fb770f8238
Merge pull request #1247 from ccoVeille/typos
fix typos in comments and tests
2024-02-25 11:59:52 +00:00
ccoVeille 85d8bb6eea
fix typos in comments, tests and github templates 2024-02-24 23:48:24 +01:00
Bracken e2741fa4e9
Merge pull request #1548 from arjunmahishi/msgAndArgs
http_assertions: honour the msgAndArgs provided with each assertion
2024-02-23 17:40:20 +00:00
Arjun Mahishi 6e59f20c0d http_assertions: assert that the msgAndArgs actually works in tests
This commit also adds the method `Failed() bool` to the mockTestingT
struct. This is usefull for asserting failure in tests
2024-02-23 22:41:24 +05:30
Arjun Mahishi 840f800f1a http_assertions: Include msgAndArgs is some of the existing tests
A mix of using and not using msgAndArgs will ensure that there is no
regression.
2024-02-23 21:20:50 +05:30
Bracken e65c014fc9
Merge pull request #1248 from guettli/patch-1
README: drop link to gorc
2024-02-23 12:59:46 +00:00
Arjun Mahishi 135b468c5a assert: honour the msgAndArgs provided in InEpsilon 2024-02-23 00:23:39 +05:30
Arjun Mahishi ecdde720b4 http_assertions: honour the msgAndArgs provided with each assertion 2024-02-23 00:16:29 +05:30
Bracken 9f0ad86b78
Merge pull request #1517 from Lucaber/equalExportedValues-ptr
Support Pointer to Struct in EqualExportedValues
2024-02-22 17:16:44 +00:00
Bracken 7c847e2503
Merge pull request #1545 from hendrywiranto/update-setupgo-v5
Update Github workflows setup-go to V5
2024-02-21 23:13:52 +00:00
hendry.wiranto 898b77d0bb try to update to v5 2024-02-21 22:31:33 +07:00
Bracken 7caada5a3b
Merge pull request #1540 from stretchr/build-badge
Update the build status badge
2024-02-20 16:23:09 +00:00
Bracken Dawson e099480d59
Update the build status badge 2024-02-20 12:36:59 +00:00
Bracken 4b9af26649
Merge pull request #1538 from stretchr/issue-templates
[chore] Add issue templates
2024-02-20 10:18:57 +00:00
Arjun Mahishi a5087d7793 [chore] Issue templates: Add link to the discussion page 2024-02-20 11:20:33 +05:30
Arjun Mahishi bd22f81c8f [chore] Issue templates: Switch from bold to H2 headings 2024-02-19 22:53:39 +05:30
Arjun Mahishi 28efcd1170 [chore] Fix typos and improve hints in the issue templates 2024-02-19 22:49:15 +05:30
Bracken fef12e7dc3
Merge pull request #1537 from stretchr/fix-time-equal
Revert "assert: ObjectsAreEqual: use time.Equal for time.Time type"
2024-02-19 12:42:59 +00:00
Arjun Mahishi 5ed61202ae
[chore] Add issue templates 2024-02-19 10:33:44 +05:30
Bracken Dawson 7b3de08425
Revert "assert: ObjectsAreEqual: use time.Equal for time.Time type"
This reverts commit 34763e0df3.

time.Time.Equal only tests that the two instances refer to the same instant, but time.Time also carries zone information, so this caused two non-equal instances to be considered equal.
2024-02-18 20:43:45 +00:00
Bracken 14ffa908e6
Merge pull request #1535 from arjunmahishi/fix-suit-deadlock
suite: fix deadlock in suite.Require()/Assert()
2024-02-18 18:34:49 +00:00
Arjun Mahishi c41592ba5f suite: fix deadlock in suite.Require()/Assert()
As pointed out in issue #1520, if the suite is not initialised properly
(buy calling the Run function), then calling suite.Require() or
suite.Assert() will result in a deadlock.

This commit fixes that by panicking if the suite is not initialised
properly. This is justified because, the suite is intended to be
triggered in the right way. If the user does not do that, this panic will
nudge them in the right direction.

It has to be a panic because, at this point, we don't have access to any
testing.T context to gracefully call a t.Fail(). Also, these two
functions are not expected to return an error.

Fixes #1520
2024-02-18 23:55:01 +05:30
Bracken c719de3088
Merge pull request #1331 from ianrose14/ianrose/assertexpectations-skipped
Ensure AssertExpectations does not fail in skipped tests
2024-02-17 17:50:13 +00:00
Bracken 0e75f9941b
Merge pull request #1485 from kevinburkesegment/len-format
assert: better formatting for Len() error
2024-02-16 15:58:11 +00:00
Kevin Burke 89c0872acd
try to do the whole format string 2024-02-15 11:35:07 -07:00
Kevin Burke f6ed021e60
assert: shorten cases 2024-02-15 11:35:07 -07:00
Kevin Burke f7fedd9f85
assert: better formatting for Len() error
Previously, the use of %s with array objects meant you would get an
error like this:

    "[%!s(int=1) %!s(int=2) %!s(int=3)]\" should have 4 item(s), but has 3

Use %v instead, which provides a much nicer error.

    "[1 2 3]" should have 4 item(s), but has 3

Fixes #1482.
2024-02-15 11:35:07 -07:00
Bracken 5911e38e09
Merge pull request #1531 from arjunmahishi/fix-equal-values
assert: Fix EqualValues to handle overflow/underflow
2024-02-14 15:22:36 +00:00
Arjun Mahishi 4c4d0118a6 assert: Fix EqualValues to handle overflow/underflow
The underlying function ObjectsAreEqualValues did not handle
overflow/underflow of values while converting one type to another
for comparison. For example:

    EqualValues(t, int(270), int8(14))

would return true, even though the values are not equal. Because, when
you convert int(270) to int8, it overflows and becomes 14 (270 % 256 = 14)

This commit fixes that by making sure that the conversion always happens
from the smaller type to the larger type, and then comparing the values.
Additionally, this commit also seperates out the test cases of
ObjectsAreEqualValues from TestObjectsAreEqual.

Fixes #1462
2024-02-14 18:12:21 +05:30
Bracken d25ac14e7d
Merge pull request #1533 from brackendawson/maintainers
Update maintainers
2024-02-14 11:07:13 +00:00
Bracken Dawson d3b6816104
Add emeritus I missed 2024-02-13 23:35:29 +00:00
Bracken Dawson a67cee3a98
Update maintainers
I think I've captured the current list of active committers.
2024-02-13 17:02:43 +00:00
Sean Marciniak c3b0c9b4f5
Merge pull request #1502 from stretchr/suite-fix-reporting-of-panic-location
suite: fix recoverAndFailOnPanic to report test failure at the right location
2024-02-01 08:44:43 +10:30
Olivier Mengué 2be68b5e9e suite: fix recoverAndFailOnPanic to report at the right location
Add calls to t.Helper() to fix the location where the panic is reported
as a test failure.
2024-01-31 16:01:43 +01:00
Olivier Mengué b139300e7e
Merge pull request #1450 from stretchr/CI-go1.21
CI: use 'stable' and 'oldstable' indirections to refers to Go versions
2024-01-31 16:00:29 +01:00
Olivier Mengué c86e139511 CI: add go 1.21 2024-01-31 15:57:41 +01:00
Sean Marciniak 9b9a3b48b1
Merge pull request #1412 from stretchr/fix-flaky-TestEventuallyIssue805
assert: fix TestEventuallyTimeout
2024-01-26 13:58:29 +10:30
Sean Marciniak 0feb1d9baf
Merge branch 'master' into fix-flaky-TestEventuallyIssue805 2024-01-25 09:12:58 +10:30
Sean Marciniak 648a7937c5
Merge pull request #1416 from stretchr/mock-simplify-matcher-check
mock: optimize argument matching checks
2024-01-22 08:48:09 +10:30
Sean Marciniak 24e57f1a77
Merge pull request #1444 from stretchr/mock-refactor-TestIsArgsEqual
mock: refactor TestIsArgsEqual
2024-01-22 08:44:43 +10:30
Sean Marciniak 12f05f76ab
Merge pull request #1453 from stretchr/fix-1292-dep-cycle-with-objx
Fix dependency cycle with objx #1292
2024-01-22 08:44:18 +10:30
Sean Marciniak 14d4b9bcc6
Merge pull request #1483 from stretchr/fix-1231-InEpsilonSlice-expected-actual-order
assert.InEpsilonSlice: fix expected/actual order and other improvements
2024-01-22 08:43:45 +10:30
Sean Marciniak 92533fad9b
Merge pull request #1506 from stretchr/assert-simplify-isNil
assert: simplify isNil implementation
2024-01-22 08:39:01 +10:30