Repository navigation
Conversation
Tests under test/stdlib exist to catch mismatches between RBS signatures and the runtime behavior. StdlibTest/NonTypeAssertion reports every assert*/refute* call except the TypeAssertions ones that check against RBS (and helpers defined in the same file). Rewrite the remaining assert_raises with assert_send_type_error, and drop the Proc arity checks in Hash_test that do not depend on RBS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Tests under
test/stdlibexist to catch mismatches between RBS signatures and the runtime behavior: a test there should fail when the RBS definition is wrong. Assertions likeassert_equalorassert_raiseskeep passing when the signature is broken, yet they keep showing up in new tests (#3216 removed the existing ones).This adds
StdlibTest/NonTypeAssertion, a local cop loaded viarequire:in.rubocop.yml.test/stdlib/**/*_test.rbonly.assert*/refute*call (andmethod(:assert...)references), except:AllowedMethods:assert_send_type,assert_send_type_error,refute_send_type,assert_const_type,assert_visibility,assert_typedefin the same file (their bodies are checked too)assert_not_nilcannot slip through.test/stdlib/constant_drift_test.rbis excluded since itsassert_emptycompares RBS declarations with runtime constants.assert_send_type,assert_send_type_error,assert_const_type).Existing offenses are fixed:
assert_raises { assert_send_type ... }in the URI tests is rewritten withassert_send_type_error.Proc#callarity checks inHash_testare removed, as they do not depend on RBS.rubocop/is excluded from the gem files. The cop's tests live intest/rubocop/and run withrake test.🤖 Generated with Claude Code