Assert the result of the conversion tests - #213
Merged
Merged
Conversation
Thirteen tests bound their result to a discarded variable and asserted nothing, so they proved only that the conversion compiles. A conversion that returned the wrong value passed them, and their names promised a result they never checked. Each now asserts the value it produces. Confirmed by changing an expected value and watching the tests fail, which they did not do before.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thirteen tests bound their result to a discarded variable and asserted nothing:
That proves the conversion compiles and nothing else. A conversion that returned the wrong value passed, and the name promised a result the test never checked.
AGENTS.mdalso asks that each test hold exactly one assertion, and these held none.Each test now asserts the value it produces:
Notes for review
From<&str>,From<String>,From<i64>,TryFrom<&str>andTryFrom<String>across all seven test files.tests/secret.rs, wherefrom_string_returns_secretconverts from a&str, is left alone here and fixed separately.just pre-commitpasses.