zig icon indicating copy to clipboard operation
zig copied to clipboard

std.fmt: Update tests

Open SeanTUT opened this issue 1 year ago • 2 comments

Changed uses of std.testing.expect to std.testing.expectEqual, std.testing.expectError, and std.testing.expectEqualStrings where appropriate

SeanTUT avatar Apr 22 '24 13:04 SeanTUT

Why the thumbs down @nektro? These changes look sensible...

linusg avatar Apr 23 '24 09:04 linusg

I initially didn't think it would compile but I see now the implementation has changed to be much more forgiving. Additionally there's been pause about switching off expect since others pull in formatted printing but since these aren't the behavior tests that may not apply here as much. and personally I think making this change should wait until https://github.com/ziglang/zig/issues/4437 is done, at which point it can be done tree-wide. having 'actual' first with the way the expect calls were laid out before this change maintains a symmetry in the tests that makes it much clearer to the reader what changes between cases

addendum: the longer I've used zig the less ive used the other expect matchers in general because its also coincided with using a debugger more often, which also illuminates the exact values at the time of the fail. in conjunction with zig's stack traces pointing directly at the offending line.

it was also more of a general feeling. now having written out a paragraph I worry it comes across like I feel much more strongly about the rejection than I did when I made the 👎

nektro avatar Apr 23 '24 10:04 nektro

Thanks!

andrewrk avatar Apr 24 '24 00:04 andrewrk