Skip to content

fix: correct test_fmt expectations in v08.rs#152

Merged
kornelski merged 1 commit intokornelski:mainfrom
lilith:fix-v08-test-fmt
Feb 11, 2026
Merged

fix: correct test_fmt expectations in v08.rs#152
kornelski merged 1 commit intokornelski:mainfrom
lilith:fix-v08-test-fmt

Conversation

@lilith
Copy link
Copy Markdown
Contributor

@lilith lilith commented Feb 8, 2026

The test_fmt test in tests/v08.rs fails on current main. Two issues:

  1. Missing u8 type annotationRGB::new(255, 0, 0) infers i32, so size_of::<i32>() = 4width = 8 → each component gets 8 hex digits instead of 2. This produces #000000FF0000000000000000 instead of #FF0000.

  2. Expected format doesn't match implementation — The test expects "RGB { #FF0000 }" but the UpperHex impl (via trait_impls_without_alpha!) produces "#FF0000" with no type name wrapper. The passing internal test in legacy/internal/rgb.rs confirms "#FF0100" is the correct format.

This also fixes the BGR expectations — both RGB::new(r,g,b) and BGR::new(r,g,b) produce #RRGGBB in 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.

- 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
@kornelski kornelski merged commit 25c3bf9 into kornelski:main Feb 11, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants