17 Commits

Author SHA1 Message Date
myxo
17b83c52e4 Fix time.Time compare 2024-03-29 08:40:17 +03: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é
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
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
Bogdan Drutu
f7b49d3ed7
Add support to compare uintptr
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
2023-02-04 16:27:21 -08: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
c29de71342 add tests for correct msgAndArgs forwarding
len(msgAndArgs)>1 should lead to fmt.Sprintf()
2022-02-10 20:09:05 +10:00
Menno
ab6dc32628 fix linting errors in /assert package 2021-08-24 21:55:23 +10:00
Yongxin Wang
bf646ea5b3 add test to check that Helper is called 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
zjx158094
d4e7ca1687 address comments 2020-05-14 19:53:33 +10:00
zjx158094
8329c5daa7 add test 2020-05-14 19:53:33 +10:00
alexpantyukhin
6be346c1f1 rename order files to compare files 2020-03-09 08:00:09 +11:00