Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kuniwak/mirrordiffkit
Graduation from messy XCTAssertEqual messages.
https://github.com/kuniwak/mirrordiffkit
diff ios library macos swift testing tvos watchos
Last synced: about 1 month ago
JSON representation
Graduation from messy XCTAssertEqual messages.
- Host: GitHub
- URL: https://github.com/kuniwak/mirrordiffkit
- Owner: Kuniwak
- License: other
- Created: 2017-02-24T13:52:21.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2023-10-17T00:23:59.000Z (about 1 year ago)
- Last Synced: 2024-04-24T14:15:36.275Z (8 months ago)
- Topics: diff, ios, library, macos, swift, testing, tvos, watchos
- Language: Swift
- Homepage:
- Size: 771 KB
- Stars: 181
- Watchers: 5
- Forks: 5
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![MirrorDiffKit](https://raw.githubusercontent.com/Kuniwak/MirrorDiffKit/master/Documentation/Images/logo.png)
=============A tool for providing the 2 features for efficient testing:
- Output diff between 2 any types
- Default implementation of Equatable for any types![](./Documentation/Images/XcodePreview.png)
Usage
-----### `diff(between: T, and: T)`
```swift
import MirrorDiffKit// Input 2 structs or classes implements Equatable:
let a = Example(
key1: "I'm not changed",
key2: "I'm deleted"
)
let b = Example(
key1: "I'm not changed",
key2: "I'm inserted"
)XCTAssertEqual(a, b, diff(between: a, and: b))
// XCTAssertEqual failed: ("Example(key1: "I\'m not changed", key2: "I\'m deleted")") is not equal to ("Example(key1: "I\'m not changed", key2: "I\'m inserted")") -
// struct Example {
// key1: "I'm not changed"
// - key2: "I'm deleted"
// + key2: "I'm inserted"
// }
```### `Any =~ Any` and `Any !~ Any`
```swift
import MirrorDiffKita = NotEquatable(
key1: "I'm not changed",
key2: "I'm deleted"
)
b = NotEquatable(
key1: "I'm not changed",
key2: "I'm inserted"
)XCTAssert(a =~ b, diff(between: a, and: b))
// XCTAssertTrue failed -
// struct NotEquatable {
// key1: "I'm not changed"
// - key2: "I'm deleted"
// + key2: "I'm inserted"
// }
```Installation
------------```
.package(url: "https://github.com/Kuniwak/MirrorDiffKit.git")
```License
-------[MIT License](./LICENSE)