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

[feat]: adopt swift-custom-dump in some testing utilities #317

Merged

Conversation

gilgtm
Copy link
Contributor

@gilgtm gilgtm commented Dec 2, 2024

  • Before: assertStateModifications was difficult to use because the diffs for failed assertions were difficult to read
  • After: Incorporate CustomDump into assertStateModifications to make the assertions easy to read

Demo

Before After
Screenshot 2024-12-02 at 10 25 14 AM Screenshot 2024-12-02 at 10 23 54 AM

Complex Demo

Before After
image image

Checklist

  • Unit Tests
  • UI Tests
  • Snapshot Tests (iOS only)
  • I have made corresponding changes to the documentation

- Before: assertStateModifications was difficult to use because the diffs for failed assertions were difficult to read
- After: Incorporate CustomDump into assertStateModifications to make the assertions easy to read
@gilgtm gilgtm requested a review from a team as a code owner December 2, 2024 18:26
Copy link

@ldstreet ldstreet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love this change 🚀

Copy link
Contributor

@jamieQ jamieQ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like a reasonable inclusion

Package.swift Outdated
@@ -64,6 +64,7 @@ let package = Package(
.package(url: "https://github.com/pointfreeco/swift-identified-collections", from: "1.0.0"),
.package(url: "https://github.com/pointfreeco/swift-macro-testing", from: "0.4.0"),
.package(url: "https://github.com/pointfreeco/swift-perception", from: "1.1.4"),
.package(url: "https://github.com/pointfreeco/swift-custom-dump", from: "1.3.3"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any particular reason this version was picked? will it be compatible with the resolved values used elsewhere (i'm assuming yes, but might as well check).

Copy link
Contributor Author

@gilgtm gilgtm Dec 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really. Register has v1.2.1 which uses the now-deprecated XCTAssertNoDifference. Good callout.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a commit to downgrade. let me know if you prefer that approach. I'm ambivalent about it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

downgrading to match other clients seems reasonable to me. i haven't looked at what changed or why it's deprecated so don't have a strong opinion either.

Comment on lines 133 to 137
_ modifications: (inout WorkflowType.State) throws -> Void,
fileID: StaticString = #fileID,
filePath: StaticString = #filePath,
line: UInt = #line,
_ modifications: (inout WorkflowType.State) throws -> Void
column: UInt = #column
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this be done in a way that is purely additive so this isn't technically a source break (and thus should require a major semver bump)?

Copy link
Contributor Author

@gilgtm gilgtm Dec 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah yeah we should probably create a new function and deprecate this one. Though it would be a lot easier to use v1.2.1 for now and handle upgrading later (or use the deprecated function here).

@gilgtm gilgtm force-pushed the gil/assertStateModifications-custom-dump branch from cd0218a to 3586399 Compare December 3, 2024 01:50
@gilgtm gilgtm force-pushed the gil/assertStateModifications-custom-dump branch from 3586399 to fd23f6a Compare December 3, 2024 01:52
@gilgtm gilgtm force-pushed the gil/assertStateModifications-custom-dump branch 4 times, most recently from d637515 to 07fbbca Compare December 4, 2024 21:47
@gilgtm gilgtm force-pushed the gil/assertStateModifications-custom-dump branch from 07fbbca to d60d294 Compare December 4, 2024 21:49
@jamieQ jamieQ changed the title assertStateModifications: swift-custom-dump [feat]: adopt swift-custom-dump in some testing utilities Dec 5, 2024
@mjohnson12 mjohnson12 merged commit c9b5a6f into square:main Dec 5, 2024
7 checks passed
@gilgtm gilgtm deleted the gil/assertStateModifications-custom-dump branch December 9, 2024 16:29
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.

5 participants