Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated Encoding, its Errors, and its tests #1510

Merged
merged 3 commits into from
Sep 19, 2023

Conversation

sampersand
Copy link
Contributor

@sampersand sampersand commented Sep 8, 2023

This updates the signatures and tests of Encoding and its errors (Encoding::CompatibilityError, Encoding::ConverterNotFoundError, Encoding::InvalidByteSequenceError, and Encoding::UndefinedConversionError).

Notably, this does not update Encoding::Converter, which will be a separate PR.

More specifically, this PR updates the following signatures:

  • Encoding._load: Added, but without documentation (as it doesn't have any).
  • Encoding.locale_charmap: Added
  • Encoding.default_external=, and Encoding.default_internal=: Updated to match _ToStr. This signature could be improved when Allow Type Variable constraints to be arbitrary types #1471 merges.
  • Encoding.find: Use encoding instead of String | Encoding.
  • Encoding.aliases, Encoding.list, Encoding.name_list, Encoding#names: Remove leading :: from signatures
  • Encoding#replicate: REMOVED ENTIRELY. See Remove Encoding#replicate ruby#7079 for details.
  • Encoding#to_s: Now an alias of Encoding.name
  • All the Encodings and errors are now underneath Encoding instead of at toplevel.

It makes the other following changes:

  • Moves Encoding_InvalidByteSequenceError_test.rb into Encoding_test.rb
  • Moves Encoding_UndefinedConversionError_test.rb.rb into Encoding_test.rb
  • Creates Encoding_CompatibilityErrorInstanceTest and Encoding_ConverterNotFoundErrorInstanceTest test classes.
  • Updates Encoding_test.rb to use the modern testing suite, testing the new new version of signatures.

@sampersand sampersand marked this pull request as ready for review September 19, 2023 02:44
@sampersand sampersand force-pushed the swesterman/23-09-08/encoding branch 3 times, most recently from 1286366 to 6b631a6 Compare September 19, 2023 03:22
Copy link
Member

@soutaro soutaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Fixing the CI errors.

@sampersand sampersand force-pushed the swesterman/23-09-08/encoding branch 2 times, most recently from bbc3516 to 3408b00 Compare September 19, 2023 05:10
@soutaro soutaro added this pull request to the merge queue Sep 19, 2023
Merged via the queue into ruby:master with commit 1502255 Sep 19, 2023
23 checks passed
@soutaro soutaro added this to the RBS 3.3 milestone Oct 31, 2023
@soutaro soutaro added the Released PRs already included in the released version label Oct 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Released PRs already included in the released version
Development

Successfully merging this pull request may close these issues.

2 participants