fix: correct test_fmt expectations in v08.rs#152
Merged
kornelski merged 1 commit intokornelski:mainfrom Feb 11, 2026
Merged
Conversation
- Add u8 suffix to prevent i32 inference (wrong hex width) - Fix expected hex format to match actual UpperHex impl (#RRGGBB, no type name wrapper) - BGR hex output matches RGB order, consistent with passing internal test
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.
The
test_fmttest intests/v08.rsfails on current main. Two issues:Missing
u8type annotation —RGB::new(255, 0, 0)infersi32, sosize_of::<i32>() = 4→width = 8→ each component gets 8 hex digits instead of 2. This produces#000000FF0000000000000000instead of#FF0000.Expected format doesn't match implementation — The test expects
"RGB { #FF0000 }"but theUpperHeximpl (viatrait_impls_without_alpha!) produces"#FF0000"with no type name wrapper. The passing internal test inlegacy/internal/rgb.rsconfirms"#FF0100"is the correct format.This also fixes the BGR expectations — both
RGB::new(r,g,b)andBGR::new(r,g,b)produce#RRGGBBin hex format (hex always prints in RGB order), which is consistent with the internal test where both produce"#FF0100".Question: Is this the intended behavior for
UpperHex/LowerHex? Or were the test expectations written to match a planned format change (e.g., adding the type name prefix)? Happy to adjust if the impl should be updated instead.