Commit Graph

1092 Commits (master)

Author SHA1 Message Date
Reda Chlieh df81388b27
Merge branch 'master' into fix/equal-exported-values-accepts-everything 2024-05-23 10:26:47 +02:00
Sean Marciniak 6b275adbf7
Merge pull request #1579 from stretchr/pluggable-yaml-package
assert: make YAML dependency pluggable via build tags
2024-05-23 15:19:21 +09:30
Sean Marciniak b661f0ade2
Merge pull request #1587 from kevinburkesegment/regex-bytes
assert.Regexp: handle []byte array properly
2024-05-22 11:19:21 +09:30
Reda Chlieh 109f4286cf
Merge branch 'master' into fix/equal-exported-values-accepts-everything 2024-05-20 11:32:27 +02:00
Olivier Mengué 3c0c0e6443
Merge pull request #1593 from brackendawson/EqualValuesDoc
Correctly document EqualValues behavior
2024-05-16 13:55:04 +02:00
Bracken Dawson 32766084e4
Correctly document EqualValues behavior 2024-04-29 13:49:40 +01:00
Bracken 8d4dcbbccb
Merge pull request #1569 from stretchr/mock-more-AnythingOfTypeArgument-alternatives
mock: document more alternatives to deprecated AnythingOfTypeArgument
2024-04-23 16:15:28 +00:00
Olivier Mengué 8c324a0bbd
mock: simpler deprecation doc for AnythingOfTypeArgument
Co-authored-by: Bracken <abdawson@gmail.com>
2024-04-23 15:23:21 +02:00
Olivier Mengué f32ff5b3cb
Merge pull request #1575 from stretchr/dependabot/github_actions/softprops/action-gh-release-2
CI: bump softprops/action-gh-release from 1 to 2
2024-04-23 14:56:52 +02:00
dependabot[bot] e33bd6fdd1
build(deps): bump softprops/action-gh-release from 1 to 2
Bumps [softprops/action-gh-release](https://github.com/softprops/action-gh-release) from 1 to 2.
- [Release notes](https://github.com/softprops/action-gh-release/releases)
- [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md)
- [Commits](https://github.com/softprops/action-gh-release/compare/v1...v2)

---
updated-dependencies:
- dependency-name: softprops/action-gh-release
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-23 12:37:40 +00:00
Olivier Mengué d4a63f5b89 mock: simplify implementation of FunctionalOptions
Remove unnecessary use of reflect in the implementation of
mock.FunctionalOptions().
2024-04-22 23:10:37 +02:00
Kevin Burke a9e6121b1c
assert: handle []byte array properly
The regexp package works more efficiently on bytes; if you have bytes,
it is easier to pass these directly to assert.Regexp than to convert
them to a string first.

In addition, FindIndex/FindStringIndex are unnecessary here because we
immediately throw away the result - let's just call Match() instead.
2024-04-17 12:18:13 -07:00
Olivier Mengué a61e9e59d6
Merge pull request #1588 from JonCrowther/fix-eventuallywithtf-example
assert: fix example for EventuallyWithT, EventuallyWithTf
2024-04-17 08:33:52 +02:00
Jonathan Crowther 4ec7678c61 Correct the EventuallyWithT and EventuallyWithTf example 2024-04-12 14:19:10 -04:00
Reda Chlieh 42d887f28b
Remove type validation in EqualExportedValues 2024-04-11 22:54:14 +02:00
Ania Kapuścińska 0e5b59666a Fix failure message formatting for Positive and Negative asserts 2024-04-11 17:41:38 +02:00
Bracken 352d2438b9
Merge pull request #1580 from JohnEndson/master
assert: fix typo in comment
2024-04-02 09:13:05 +00:00
Bracken 726249eca2
Merge pull request #1582 from myxo/master
Fix time.Time compare
2024-04-01 15:42:55 +00:00
Olivier Mengué d3dbb19355 assert: make YAML dependency pluggable via build tags
Make the YAML dependency required for {assert,require}.YAMLEq{,f} pluggable.

The implementation can be selected using build tags:
- testify_yaml_default (default): gopkg.in/yaml.v3 is used, like before
- testify_yaml_fail: YAML deserialization is not implemented and always
  fails. So assert.YAMLEq always fails. This is useful if the test suite
  package doesn't use assert.YAMLEq (very common case).
- testify_yaml_custom: the github.com/stretchr/testify/assert/yaml
  package exposes an Unmarshal variable of type func([]byte, any) error
  (same as gopkg.in/yaml.v3) that allows to plug any alternate
  implementation. For example github.com/goccy/go-yaml.Unmarshal.
  This allows to avoid the link constraints of the license of
  gopkg.in/yaml.v3 (see PR stretchr/testify#1120).

Usage: go test -tags testify_yaml_fail

To install the alternate implementation with testify_yaml_custom:

	//go:build testify_yaml_custom

	package my_pkg_test

	import (
		goyaml "github.com/goccy/go-yaml"
		"github.com/stretchr/testify/assert/yaml"
	)

	func init() {
		yaml.Unmarshal = goyaml.Unmarshal
	}
2024-03-31 22:37:21 +02:00
myxo 17b83c52e4 Fix time.Time compare 2024-03-29 08:40:17 +03:00
JohnEndson a2fbbfe71b assert: fix typo in comment
Signed-off-by: JohnEndson <jiayuzhen@outlook.com>
2024-03-29 11:39:16 +08:00
Olivier Mengué be3fbeb943
Merge pull request #1568 from stretchr/doc-testifylint
README: link out to the excellent testifylint
2024-03-28 23:14:32 +01:00
Olivier Mengué edd74b24a1
Merge pull request #1433 from snirye/master
mock: fix FunctionalOptions docs
2024-03-22 14:01:47 +01:00
Bracken 740a5e83fa
Suggest golangci-lint in README.md as well as doc.go
Co-authored-by: Olivier Mengué <dolmen@cpan.org>
2024-03-20 12:51:19 +00:00
Olivier Mengué 404159f5fa
Merge pull request #1566 from stretchr/assert-deprecate-CompareType
assert: deprecate CompareType
2024-03-20 00:49:17 +01:00
Olivier Mengué a155d2a49d assert: restore CompareType, but mark it as deprecated
Reinstate CompareType for full backward compatibility, but mark it as
deprecated.
2024-03-20 00:47:39 +01:00
Olivier Mengué 39442a4e4e assert: drop CompareType
Rename CompareType to compareResult to make it private. This type is
used only in internal functions and is of no use for external users and
should never have been made public.

CompareType has been introduced by 0b4ff03cda
and appeared in releases since v1.6.0.

Note: strictly speaking, this is a breaking change, but no external user
should have ever used assert.CompareType as it made no sense in the assert
API. A search on GitHub has revealed no use of it.
https://github.com/search?q=assert.CompareType+language%3AGo&type=Repositories&ref=advsearch&l=Go&l=
2024-03-20 00:47:39 +01:00
Olivier Mengué 74e1cbebab assert: minor refactor of compareTwoValues tests
Refactor compareTwoValues tests to free the 'compareResult' symbol name
(for incoming use of this name in next commit).
2024-03-20 00:47:39 +01:00
Olivier Mengué a71299064b assert: refactor Test_compareTwoValuesCorrectCompareResult
Refactor Test_compareTwoValuesCorrectCompareResult table test to be more
explicit: "compareTypes" renamed to "allowedResults".
2024-03-20 00:47:39 +01:00
Snir Yehuda da1e1476cb
Merge branch 'master' into master 2024-03-18 09:47:57 +02:00
Olivier Mengué 3c302f75ae
mock: improve doc (#1570)
## Summary
Improve API doc of package
[`mock`](https://pkg.go.dev/github.com/stretchr/testify/mock):
- add godoc links
- indent example code

## Motivation
Readability.
2024-03-10 11:42:04 +01:00
Bracken Dawson 1dedc83b8f
Add testifylint to godocs too
I checked the render locally.
2024-03-07 15:09:29 +00:00
Olivier Mengué aca1890ec1 mock: document more alternatives to deprecated AnythingOfTypeArgument 2024-03-07 11:59:12 +01:00
Bracken Dawson bfa3ee96e3
Link out to the excellent testifylint 2024-03-07 00:13:49 +00:00
Snir Yehuda f1b5324b90 assert.FunctionalOptions: fix go doc 2024-03-06 11:28:50 +03:00
Olivier Mengué 632a26080f
Merge pull request #820 from TomWright/master
Do not get argument again unnecessarily in Arguments.Error()
2024-03-06 03:05:06 +01:00
Tom Wright cab2acc70f Do not get argument again unnecessarily in Arguments.Error() 2024-03-06 03:03:10 +01:00
Olivier Mengué edb801534f
Merge pull request #1565 from stretchr/gitignore-test-binaries
.gitignore: ignore "go test -c" binaries
2024-03-05 12:09:22 +01:00
Olivier Mengué 89ffab03a5
Merge pull request #1562 from stretchr/make-tHelper-a-type-alias
assert: make tHelper a type alias
2024-03-05 10:48:10 +01:00
Fahim Bagar 8585d8de96
Add PanicAssertionFunc (#1337, #730)
Add a `PanicAssertionFunc` to ease writing table-driven tests for panic
assertion.

Closes #730
2024-03-05 10:13:30 +01:00
Olivier Mengué e5e71998af gitignore: ignore "go test -c" binaries
Ignore binaries produced by "go test -c".
2024-03-04 22:37:21 +01:00
Olivier Mengué 85fabe7c5c assert: make tHelper a type alias
The tHelper interface is defined only for internal usage. We don't need
a "hard" type for it as we don't define methods on it. Let's make is
just a alias to the anonymous interface it represents.

Note: we are already using type aliases elswhere, and type aliases were
introduced a long time ago in Go 1.9.
2024-03-03 18:29:24 +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