Closed komuw closed 2 years ago
Hi @komuw! Sorry for the delay, I was on vacation for a bit.
cmp.Diff
takes its arguments in the opposite order. The printed diff in your example is correct: compared to the expected result, you're missing "hell" and have "hello" instead.
I was talking about the order(or sequence).
The signature of attest.Equal
is;
attest.Equal(t, got, want)
^ ^
got is first want is second
and in the failure message;
diff (+got, -want):
^ ^
got is first want is second
and in the diff;
string(- "hell", + "hello", )
^ ^
want is first got is second
so in the diff, the sequence is flipped: want comes first
But it is a minor thing and I'm happy to close this.
Thanks for the awesome library!
If you have a program like (https://go.dev/play/p/6gWHICoz0xd):
and you run it, you get a diff like:
In
attest
all the functions likeEqual
takegot
as the first argument and thenwant
. So I would expect that when it comes to displaying the diff, it would follow the same order. ie,got
is displayed first and thenwant
.However the diff displays the
want
first(in the example above;- "hell",
)