Skip to content
This repository was archived by the owner on Nov 11, 2023. It is now read-only.

Update JSON tests to use 'std.testing.expectEqual' #31

Closed
wants to merge 1 commit into from
Closed

Update JSON tests to use 'std.testing.expectEqual' #31

wants to merge 1 commit into from

Conversation

craig-mcd
Copy link
Contributor

Use the more descriptive 'expectEqual' testing function. This is also used in the Zig stdlib tests.

@alichraghi
Copy link
Member

that looks complex for new user

@craig-mcd
Copy link
Contributor Author

It could made more explicit but verbose by splitting out the 'expected' and 'actual' values of the call.

I would still say that is a better testing function to use.

https://ziglang.org/documentation/master/std/#A;std:testing.expectEqual

This function is intended to be used only in tests. When the two values are not equal, prints diagnostics to stderr to show exactly how they are not equal, then returns a test failure error. actual is casted to the type of expected.

@alichraghi
Copy link
Member

expectEqual is intended to use for structs and big types. there's no reason to use it over expect when you're comparing integers.

@alichraghi
Copy link
Member

not rejecting, just wanted to put my two cents. feel free to push merge button if you aren't convinced

@craig-mcd
Copy link
Contributor Author

Your project mate, just helping where I can 😀. Not fussed either way.

@alichraghi alichraghi closed this Jun 25, 2023
@craig-mcd craig-mcd deleted the json-tests branch June 25, 2023 17:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
2 participants