Problem
The field-sorting middleware tests reuse one module-level mutable Entry. Because in-place middleware cases reorder that shared object, later tests can inherit earlier mutations and assert an order that depends on test execution history rather than the documented behavior.
The suite also leaves several useful contracts implicit:
- fields omitted from a custom order retain their original relative order;
- custom ordering works through the public writer without mutating the source library when in-place modification is disabled; and
- ambiguous custom orders with duplicate keys, including case-only duplicates under case-insensitive matching, fail early.
Proposed coverage
Construct a fresh entry for each test, correct the stable-order assertion, and add focused public-writer and duplicate-order cases. This should be a test-only change because current production behavior already satisfies the contracts.
Problem
The field-sorting middleware tests reuse one module-level mutable
Entry. Because in-place middleware cases reorder that shared object, later tests can inherit earlier mutations and assert an order that depends on test execution history rather than the documented behavior.The suite also leaves several useful contracts implicit:
Proposed coverage
Construct a fresh entry for each test, correct the stable-order assertion, and add focused public-writer and duplicate-order cases. This should be a test-only change because current production behavior already satisfies the contracts.