Some `AttributedString`s don't print any diffs although they are not equal
oronbz opened this issue · comments
Oron Ben Zvi commented
Describe the bug
Some AttributedString
s don't print any diffs although they are not equal
To Reproduce
CustomDumpAttributedString.zip
// If you’ll run this test:
func testAttributedString() throws {
var stringOne = AttributedString("One")
stringOne.font = .body
var stringTwo = AttributedString("One")
stringTwo.font = .callout
XCTAssertNoDifference(stringOne, stringTwo)
}
// It’ll fail, but the printed dump will make it look like there are no differences at all:
XCTAssertNoDifference failed: …
"One"
(First: −, Second: +)
// Where if I change the text to be different in addition to the font:
func testAttributedString() throws {
var stringOne = AttributedString("One")
stringOne.font = .body
var stringTwo = AttributedString("Two")
stringTwo.font = .callout
XCTAssertNoDifference(stringOne, stringTwo)
}
// it prints it correctly:
XCTAssertNoDifference failed: …
− "One"
+ "Two"
(First: −, Second: +)
// This problem is especially prominent when the AttributedString is a property of a State object inside of a Store, the test could fail and you’ll have no idea that the AttributedString is the one which is different:
XCTAssertNoDifference failed: …
State(
string: "One",
number: 3
)
(First: −, Second: +)
Expected behavior
// In my opinion I would expect at least:
- "One"
+ "One"
Environment
- swift-custom-dump 1.1.2
- Xcode 15.0 (15A240d)
- Swift 5.9
- OS: iOS 17.0