fix: Use Minitest must_raise correctly and handle error message#92
Open
mtasaka wants to merge 1 commit intocopiousfreetime:mainfrom
Open
fix: Use Minitest must_raise correctly and handle error message#92mtasaka wants to merge 1 commit intocopiousfreetime:mainfrom
mtasaka wants to merge 1 commit intocopiousfreetime:mainfrom
Conversation
`must_raise` is sort of the alias for `assert_raises`, and actually https://github.com/minitest/minitest/blob/v6.0.5/lib/minitest/assertions.rb#L390 says that `assert_raises` can take an optional "message" (i.e. string) to help explain failures, so not regex or so to test if assertion message matches it. Up to Minitest 6.0.4, when passing regex for `assert_raises` it was simply ignored, ref: minitest/minitest#1068 https://bugs.ruby-lang.org/issues/22007 Now Minitest 6.0.5 explicitly refuses this usage as: minitest/minitest@6790f86 and now `must_raise` also refuses this usage. Closes copiousfreetime#91 .
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.
must_raiseis sort of the alias forassert_raises, and actually https://github.com/minitest/minitest/blob/v6.0.5/lib/minitest/assertions.rb#L390 says thatassert_raisescan take an optional "message" (i.e. string) to help explain failures, so not regex or so to test if assertion message matches it.Up to Minitest 6.0.4, when passing regex for
assert_raisesit was simply ignored, ref:minitest/minitest#1068
https://bugs.ruby-lang.org/issues/22007
Now Minitest 6.0.5 explicitly refuses this usage as: minitest/minitest@6790f86 and now
must_raisealso refuses this usage.Closes #91 .