23 Commits

Author SHA1 Message Date
Bracken
c3915e850a
Merge branch 'master' into refactor/simplify-with-sprintf-q 2025-03-23 14:22:18 +01:00
Oleksandr Redko
30f3cef5ad Apply suggestions from code review
Co-authored-by: Olivier Mengué <dolmen@cpan.org>
2024-12-10 14:08:46 +02:00
Oleksandr Redko
d57bac8721 refactor: use %q to simplify fmt.Sprintf 2024-11-24 18:28:03 +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
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é
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 0b4ff03cda5c8eb0150a14ffbaaa088fd777d6ba
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é
21ba5d23bb
Merge branch 'master' into uintptr 2023-10-30 23:51:22 +01:00
Oleksandr Redko
1ee798c140 Remove canConvert because Go 1.16 is dropped from support 2023-10-10 14:28:34 +02:00
Ed
9f0f17fe64 Correct spelling/grammar 2023-05-26 10:38:59 +01:00
Harald Nordgren
4c93d8f201
EqualExportedValues: Handle nested pointer, slice and map fields (#1379)
* EqualExportedValues: Handle pointer and slice fields

* Update assert/assertions.go

Co-authored-by: Michael Pu <michael.pu123@gmail.com>

* Reduce redundant calls to 'copyExportedFields'

* Update comments

* Add support for maps

* Update Go version support to 1.19 and onward

* Re-generate after rebasing

---------

Co-authored-by: Michael Pu <michael.pu123@gmail.com>
2023-05-11 07:42:04 +10:00
Bogdan Drutu
f7b49d3ed7
Add support to compare uintptr
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2023-02-04 16:27:21 -08:00
Ryan Leung
c31ea0312f
Support comparing byte slice (#1202)
* support comparing byte slice

Signed-off-by: Ryan Leung <rleungx@gmail.com>

* address the comment

Signed-off-by: Ryan Leung <rleungx@gmail.com>
2022-06-21 14:54:58 +10:00
Torkel Rogstad
83198c2c50 assert: guard CanConvert call in backward compatible wrapper 2022-02-15 20:26:04 +10:00
Torkel Rogstad
087b655c75 assert: allow comparing time.Time 2022-02-15 20:26:04 +10:00
Ilia Kravets
7bcf74e94f fix msgAndArgs forwarding 2022-02-10 20:09:05 +10:00
Yongxin Wang
6f81fdf1db fix the output source file in test output 2021-01-15 21:06:28 +11:00
Masaya Hayashi
1544508911 add assert positive/negative 2020-11-03 21:37:46 +11:00
Torkel Rogstad
51595dcf94 Allow comparing custom comparable types
Prior to this commit, this would not work:

```go
type myInt int
assert.Less(t, myInt(1), myInt(2)) // panic!
```

We add some type conversions, similarly to how `ObjectsAreEqualValues`
work. This allows us to compare `myInt` to `myInt`, as well as `myInt`
to `int`.
2020-06-22 19:40:53 +10:00
zjx20
3ec00f620a assertion_compare: fix format string for numbers 2020-05-14 19:53:33 +10:00
alexpantyukhin
6be346c1f1 rename order files to compare files 2020-03-09 08:00:09 +11:00