Updated Encoding, its Errors, and its tests #1510
Merged
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.
This updates the signatures and tests of
Encoding
and its errors (Encoding::CompatibilityError
,Encoding::ConverterNotFoundError
,Encoding::InvalidByteSequenceError
, andEncoding::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
: AddedEncoding.default_external=
, andEncoding.default_internal=
: Updated to match_ToStr
. This signature could be improved when Allow Type Variable constraints to be arbitrary types #1471 merges.Encoding.find
: Useencoding
instead ofString | Encoding
.Encoding.aliases
,Encoding.list
,Encoding.name_list
,Encoding#names
: Remove leading::
from signaturesEncoding#replicate
: REMOVED ENTIRELY. See Remove Encoding#replicate ruby#7079 for details.Encoding#to_s
: Now an alias ofEncoding.name
Encoding
s and errors are now underneathEncoding
instead of at toplevel.It makes the other following changes:
Encoding_InvalidByteSequenceError_test.rb
intoEncoding_test.rb
Encoding_UndefinedConversionError_test.rb.rb
intoEncoding_test.rb
Encoding_CompatibilityErrorInstanceTest
andEncoding_ConverterNotFoundErrorInstanceTest
test classes.Encoding_test.rb
to use the modern testing suite, testing the new new version of signatures.