Commit Graph
78 Commits
Author SHA1 Message Date
Stephen Celis 44f4e54ecc Make _CustomDiffObject more generally hashable 2024-11-30 12:31:50 -06:00
Malte 743ace306f update doc for expectDifference (#132) 2024-10-16 11:00:20 -07:00
Shai Mishali 4c7b915994 expectDifference/expectNoDifference rename cleanups (#129)
While upgrading I noticed some of the docs / existing tests still use the old naming, so took a few moments to update.
2024-08-21 17:45:10 -04:00
Sven A. Schmidt 82645ec760 Fix Swift 6 concurency error (#127) 2024-08-02 08:12:11 -07:00
Stephen CelisandBrandon Williams d237304f42 Swift Testing support (#124)
* Swift testing

* wip

* wip

* wip

* test

* wip

* wip

* wip

* wip

---------

Co-authored-by: Brandon Williams <mbrandonw@hey.com>
2024-07-22 15:03:56 -07:00
Stephen Celis f48c096f85 Swift Language Support: Drop <5.9, Add 6.0 (#121)
* Swift Language Support: Drop <5.9, Add 6.0

* wip

* wip

* wip

* wip

* wip
2024-06-18 08:03:05 -07:00
Brandon Williams a918a380cc Fix sendable warnings. (#117) 2024-04-17 15:35:35 -07:00
stephencelis 2a7c7110f6 Run swift-format 2024-03-12 21:38:02 +00:00
Stephen Celis f01efb26f3 Improve object diffing tools (#111)
* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* fix

* Swift 5.7 fix

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip
2024-03-12 14:31:41 -07:00
Stephen Celis 3ce83179e5 Fix Xcode 15.3 Release Crash (#108)
A SIL function we load seems to be unavailable, so let's limit old key
path printing to DEBUG builds.
2024-02-27 10:24:39 -08:00
Stephen Celis 6ea3b1b6a4 Add experimental support for "diffable" objects (#105)
* Experimental protocol to diff an object w/ history

* wip

* wip

* test

* wip

* wip

* wip

* wip
2024-02-09 13:51:53 -08:00
Stephen Celis cc390880a3 DocC (#103)
* DocC

* wip
2024-02-09 13:11:21 -08:00
Aaron Farnham aedcf6f4cd Update for visionOS beta 6 (#101) 2023-11-27 10:08:55 -08:00
Stephen Celis 65fc9e2b62 wip 2023-10-31 13:23:42 -07:00
Stephen Celis b803caace2 Filter properties prefixed with _$ (#100) 2023-09-28 06:57:43 -07:00
stephencelis c2012e1ead Run swift-format 2023-08-23 21:25:26 +00:00
Stephen CelisandBrandon Williams 056dea6d9f Add XCTAssertDifference for exhaustively testing changes to values (#51)
* Add `XCTAssertDifference` for testing changes to values

* wip

* wip

* Docs

* Update Tests/CustomDumpTests/XCTAssertDifferenceTests.swift

Co-authored-by: Brandon Williams <135203+mbrandonw@users.noreply.github.com>

* wip

* wip

---------

Co-authored-by: Brandon Williams <135203+mbrandonw@users.noreply.github.com>
2023-08-23 14:19:10 -07:00
Stephen Celis a146af9748 Restore key path debug description in 5.9 (#95) 2023-07-12 11:41:23 -07:00
Stephen Celis 3a35f7892e visionOS Support (#94)
* visionOS Support

* wip

* try again
2023-06-21 16:48:27 -07:00
Rhys Morgan 2751e27175 Allows CustomDump to build on visionOS/xrOS (#93) 2023-06-21 15:50:10 -07:00
Stephen Celis 9bc76705ca Add dump format for Duration (#92)
* Add dump format for Duration

* wip

* wip

* wip

* wip

* wip

* wip

* wip
2023-06-20 16:28:04 -07:00
Stephen Celis 505aa98716 Sort unordered dictionaries when nested in another type (#91)
Fixes #87.

The generic `T` is `Any` when traversing deeper into the mirror. It's
possible that we should be opening existentials more explicitly at each
layer, but we already have the mirror's subject type, so we can use that
instead.
2023-05-12 09:10:32 -07:00
Stephen Celis 53169c423c Fix CustomDumpRepresentable max depth (#88)
* Fix `CustomDumpRepresentable` max depth

When we reach a custom dump representable value, we should not decrement
the max depth when printing it.

At times this can cause the max depth to roll from 0 to -1, which
currently causes the logic that collapses nodes to leave them expanded.

We should update that logic, as well, so I'll do that in another commit.

* Treat negative depth as zero

* Add/fix some unrelated tests
2023-05-04 09:54:23 -07:00
Stephen Celis 84b30e1af7 Only print "no difference detected" when diff output is the same (#85)
* Only print "no difference detected" when diff output is the same

* wip

* fix for Xcode 13.4.1
2023-04-13 14:04:03 -07:00
Stephen Celis 21404fead4 Show difference when values are equal if labels differ (#84) 2023-04-12 16:34:29 -07:00
Stephen Celis 805c57f32a Don't use AnyKeyPath.debugDescription due to crash (#81)
* Don't use `AnyKeyPath.debugDescription` due to crash

SE-0369's implementation unfortunately has a crash related to dynamic
member lookup, so we should revert our reliance on it till the bug is
fixed.

See https://github.com/apple/swift/issues/64865 for more info.

* wip

* wip

* wip
2023-04-03 10:59:29 -07:00
stephencelis 6a90124ac7 Run swift-format 2023-03-22 18:27:33 +00:00
Stephen Celis be44c34910 Support ordered dictionaries/sets (#80)
We currently auto-sort the children of any mirror with a display style
of dictionary or set alphabetically. This is important for consistent
dumps (good for snapshot tests, too), but affects types that don't need
the sorting, like ordered dictionaries and sets.

This PR introduces an `_UnorderedCollection` protocol to control this
behavior, and conforms `Dictionary`, `Set`, and their `NS`-
predecessors, but leaves other types open to dumping and diffing in an
ordered way by default.
2023-03-22 11:08:42 -07:00
Stephen Celis 2a3499352e Add String.init(customDumping:) (#79)
* Add `String.init(customDumping:)`

It can be useful to get a custom dump representation of a value as a
string on a single line. Swift provides `String.init(describing:)` and
`String.init(reflecting:)` (though no equivalent for a quick string from
`Swift.dump`), so maybe we can provide _similar_ functionality via a
string initializer.

* oops
2023-03-13 19:27:42 -07:00
stephencelis 2bb5551b6c Run swift-format 2023-03-08 21:43:51 +00:00
Stephen Celis 79cb03ef21 Abbreviate optional, array, and dictionary types (#78)
We try our best to pretty-print in a Swift-y fashion, so let's extend
that to the shorthand syntaxes for optionals, arrays, and dictionaries.
2023-03-08 13:27:39 -08:00
Stephen Celis de8ba65649 Fix regression in typeName output (#77)
* Fix regression in `typeName` output

The regular expression that strips excessive info from type names was
refactored in #73 to fix some bugs that were discovered, but this change
caused a regression in some nested types.

* fix

* wip
2023-03-07 17:37:57 -08:00
mbrandonw e266399f31 Run swift-format 2023-03-07 22:44:59 +00:00
Brandon Williams 0dd3e712ff Lock access to keyPathToName in key path printing. (#76)
* Lock access to keyPathToName for key path printing.

* slack release

* modernize
2023-03-07 14:37:58 -08:00
Stephen Celis adef407be3 Use AnyKeyPath.customDebugDescription when possible (#73)
* Use `AnyKeyPath.customDebugDescription` when possible

New in Swift 5.8 with implementation of
[SE-0369](https://github.com/apple/swift-evolution/blob/main/proposals/0369-add-customdebugdescription-conformance-to-anykeypath.md).

* Linux support.

* Linux tests

* Fix warning

* Fix

* wip

* wip

* wip
2023-02-22 15:05:06 -08:00
Stephen Celis dd86159e25 Tests 2023-02-03 11:29:00 -08:00
Stephen Celis 3860d0beee Abbreviate enums in diffs (#72)
* Abbreviate enums in diffs

We added the ability to abbreviate nested dumps in #71, but this didn't
transfer to diffs.

* wip

* Fix for old Swift runtime
2023-02-03 11:08:14 -08:00
Stephen Celis 87dd388a19 Abbreviate nested enums (#71)
We can use dot-abbreviation to keep descriptions short but provide
enough context.
2023-01-30 17:06:26 -08:00
Stephen Celis ead7d30cc2 Update CI to use latest Xcode, test in release (#68)
* Bump CI

* wip

* wip

* wip

* wip

* Fix key path release bug

* bump
2022-11-07 11:59:46 -08:00
Mahmood Tahir 0ff5e251d0 AnyHashable dump conformance (#64)
* AnyHashable dump conformance

Without it the Mirror for AnyHashable has a style of nil so it just uses string interpolation and doesn't dump properly

* Add tests

* Move to Swift.swift file
2022-10-20 13:34:35 -07:00
Mahmood Tahir 8e64f1eee6 Add ids to second occurrence of a type within a dump (#60)
* Add ids to second occurrence of a type within a dump

* Update logic

* Cleanup

* Update tests after rebase

* Use # instead of <>
2022-10-03 13:43:57 -07:00
Mahmood Tahir d7f18c3e8a Add support to dump superclass nodes (#58)
* Add support to dump subset of children and superclass nodes

* Dump superclass by default

* Clean up code based on @iampatbrown's feature branch

* More cleanup

* revert unrelated indentation

* Remove new protocols

* Revert some syntax changes
2022-10-03 09:54:31 -07:00
Stephen Celis c9b6b940d9 Temporary fix for Xcode 14.1 (#56) 2022-09-14 18:58:08 -04:00
Stephen Celis b7500c3ce7 Add CI for SwiftWASM (#55)
* Add WASM to CI

* wip

* wip

* wip

* wip

* wip

* wip
2022-09-13 00:02:17 -04:00
stephencelis 3737faeece Run swift-format 2022-09-13 03:41:37 +00:00
Yasuhiro Inami 55b08ec65d Add if !os(WASI) for SwiftWasm (#53) 2022-09-12 23:34:55 -04:00
Stephen Celis 11ccf4ca40 Use _typeName instead of String.init(reflecting:) (#52) 2022-06-20 14:54:55 -04:00
Stephen Celis 253e3d9130 Differentiate equal dumps of different types (#49)
Fixes #48.
2022-05-03 11:11:45 -04:00
Brentley Jones e7c6d6444d Show label for visited items (#43) 2022-03-02 09:18:32 -05:00
Stephen Celis 1c384565cf Revert removal of platform requirements (#42)
* Partially revert "f8c70309e75569964669af8a068fb0d0312c323f"

* Revert "Remove platform requirements (#37)"

This reverts commit fa2eb2572b.
2022-02-18 18:02:48 -05:00