Repository navigation
Fix debug_non_utf8_classname on non-MacRoman systems - #878
Merged
Merged
Conversation
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.
Fixes #863.
Problem
debug_non_utf8_classnameregisters a class whose name contains invalid UTF-8 (My\xF0\x90\x80Class), and compares theDebugoutput of an instance against a hardcoded string.-descriptiondecodes the name using the system text encoding, but the hardcoded string is what you get with MacRoman, so the test fails on machines that use a different encoding, such as when the system language is set to Japanese:Fix
Build the expected class name from
[cls description]instead, which is decoded the same way. Since this only changes a test, I didn't add a changelog entry.Testing
On macOS 26.6.2 (Aarch64),
cargo test -p objc2 --lib debug_non_utf8_classnamepasses with__CF_USER_TEXT_ENCODINGset to MacRoman, Japanese, Traditional Chinese, Korean, Cyrillic and Simplified Chinese. Without the fix, it fails with everything except MacRoman, and I also confirmed that switching the system language between Japanese and English changes the result.The rest of
cargo test -p objc2passes with MacRoman and Japanese, as docargo fmt -- --checkandcargo clippy -p objc2 --all-targets.