Skip to content

Commit

Permalink
internal/tdtest: use field name in default error message
Browse files Browse the repository at this point in the history
Signed-off-by: Marcel van Lohuizen <mpvl@gmail.com>
Change-Id: I20728f8ec7d6f1bb899c227cebd70ee98dd94c02
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/552273
Unity-Result: CUEcueckoo <cueckoo@cuelang.org>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Reviewed-by: Roger Peppe <rogpeppe@gmail.com>
  • Loading branch information
mpvl committed Apr 11, 2023
1 parent c3c8eb7 commit 401cab2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion internal/tdtest/tdtest.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ func (t *T) Equal(actual, field any, msgAndArgs ...any) {
info, ci := t.getCallInfo()
t.updateField(info, ci, actual)
case len(msgAndArgs) == 0:
t.Errorf("unexpected value:\ngot: %v;\nwant: %v", actual, field)
_, ci := t.getCallInfo()
t.Errorf("unexpected value for field %s:\ngot: %v;\nwant: %v", ci.fieldName, actual, field)
default:
format := msgAndArgs[0].(string) + ":\ngot: %v;\nwant: %v"
args := append(msgAndArgs[1:], actual, field)
Expand Down

0 comments on commit 401cab2

Please sign in to comment.