Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some AttributedStrings don't print any diffs although they are not equal #104

Open
oronbz opened this issue Nov 30, 2023 · 0 comments
Open

Comments

@oronbz
Copy link

oronbz commented Nov 30, 2023

Describe the bug
Some AttributedStrings 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
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

No branches or pull requests

1 participant