Skip to content

test(decode): fix Errorf argument order in array-to-struct case#798

Open
Solaris-star wants to merge 1 commit into
fxamacker:masterfrom
Solaris-star:fix/784-decode-errorf-arg-order
Open

test(decode): fix Errorf argument order in array-to-struct case#798
Solaris-star wants to merge 1 commit into
fxamacker:masterfrom
Solaris-star:fix/784-decode-errorf-arg-order

Conversation

@Solaris-star

Copy link
Copy Markdown

Summary

In TestUnmarshalArrayToStructNoToArrayOptionError, the t.Errorf call for the "want error containing" branch swapped err.Error() and v1.

That makes failure messages misleading (and mismatches the format verbs).

Fix

Pass v1 then err.Error() to match:
Decode(%+v) returned error %q, want error containing %q

Fixes #784

Test plan

  • go test -run TestUnmarshalArrayToStruct .

TestUnmarshalArrayToStructNoToArrayOptionError swapped the decoded
value and error string in t.Errorf, producing misleading failure
output.

Fixes fxamacker#784
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix Decode test Errorf argument order

1 participant