Skip to content

Add @CustomDump macro#153

Closed
stephencelis wants to merge 42 commits intomainfrom
diffable-state
Closed

Add @CustomDump macro#153
stephencelis wants to merge 42 commits intomainfrom
diffable-state

Conversation

@stephencelis
Copy link
Copy Markdown
Member

@stephencelis stephencelis commented Feb 3, 2026

Filling a similar niche as Swift's upcoming @DebugDescription macro, it will automatically generate a CustomDumpRepresentable conformance for a class with an inner, equatable CustomDumpValue. This can be used for better exhaustive testing via expectDifference:

@CustomDump
@MainActor
@Observable
final class FeatureModel {
  var count = 0

  func incrementButtonTapped() { count += 1 }
}

let model = FeatureModel()
expectDifference(model) {
  model.incrementButtonTapped()
} changes: {
  $0.count = 1
}

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