diff options
| author | Eugene Triguba <eugenetriguba@gmail.com> | 2024-02-19 09:09:57 -0500 |
|---|---|---|
| committer | Eugene Triguba <eugenetriguba@gmail.com> | 2024-02-19 09:10:11 -0500 |
| commit | 328d6e27346a5c4354721f086fecc17fe66cc92e (patch) | |
| tree | 20fb3010bfa170a87f275ae115a8a3502d84a3d8 | |
| parent | Release v0.3.1 (diff) | |
| download | checkmate-328d6e27346a5c4354721f086fecc17fe66cc92e.zip | |
Fix error message with Equal
| -rw-r--r-- | CHANGELOG.md | 6 | ||||
| -rw-r--r-- | check/check.go | 4 |
2 files changed, 8 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 4dc26cc..a09ca32 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +### Fixed + +- `check.Equal` and `assert.Equal` had the expected and actual values flipped in the test failure error message. + ## [0.3.1] - 2024-02-11 ### Fixed diff --git a/check/check.go b/check/check.go index ffc4bb5..486d7cf 100644 --- a/check/check.go +++ b/check/check.go @@ -44,7 +44,7 @@ func NotNil(t checkmate.TestingT, value any, msgAndArgs ...any) bool { } if len(msgAndArgs) == 0 { - msgAndArgs = []any{"expected value to not be nil, got nil", value} + msgAndArgs = []any{"expected value to not be nil, got nil"} } return check(t, value != nil, msgAndArgs...) @@ -166,7 +166,7 @@ func Equal(t checkmate.TestingT, actual, expected any, msgAndArgs ...any) bool { } if len(msgAndArgs) == 0 { - msgAndArgs = []any{"expected %v to equal %v", expected, actual} + msgAndArgs = []any{"expected %v to equal %v", actual, expected} } return check(t, actual == expected, msgAndArgs...) |