• Stars
    star
    183
  • Rank 210,154 (Top 5 %)
  • Language
    Swift
  • License
    Other
  • Created over 7 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Graduation from messy XCTAssertEqual messages.

MirrorDiffKit

Swift 5.0 compatible CocoaPods Carthage Swift Package Manager MIT license

A tool for providing the 2 features for efficient testing:

  • Output diff between 2 any types
  • Default implementation of Equatable for any types

Platform Status
macOS Bitrise
Linux CircleCI

Usage

diff<T>(between: T, and: T)

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

import MirrorDiffKit

a = 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

Swift Package Manager

Add the following line to your Package.swift:

.package(url: "https://github.com/Kuniwak/MirrorDiffKit.git")

Carthage

Add the following line to your Cartfile:

github "Kuniwak/MirrorDiffKit"

CocoaPods

pod "MirrorDiffKit"

More Repositories

1

TestableDesignExample

Sample App to learn a testable design (Smalltalk flavored MVC)
Swift
84
star
2

MultipartFormDataKit

Simple library for multipart/form-data for Swift.
Swift
66
star
3

WiFiQRCodeKit

Library helping Wi-Fi configurations over QR codes
Swift
39
star
4

stamp

My stamp images
HTML
18
star
5

UIKitTestable

UIKit becomes testable.
Swift
18
star
6

RxNextExample

Swift
18
star
7

JsDoc2-Template-Bootstrap

Beautiful Template with Bootstrap for JsDoc2.
JavaScript
17
star
8

iceberg.icls

A dark blue color scheme for IntelliJ IDEA (original is for Vim)
16
star
9

MemoryLeakTestKit

Swift
16
star
10

how-to-debug-js

https://speakerdeck.com/orgachem/guan-reru-js-su-zao-kujiu-ming-debatuguru-men
JavaScript
10
star
11

isabelle-range

Isabelle
7
star
12

jenkins-plugin-fixator

CLI tool to manage Jenkins plugins
Shell
6
star
13

ddsv-prolog

Prolog implementation for https://principia.connpass.com/event/143181/
Prolog
6
star
14

piine

"piine" is a web app that provides real-time feedback during your presentation.
JavaScript
6
star
15

dotfiles

My dotfiles.
TypeScript
6
star
16

vim-qrcode

VIM meets QR Code.
Vim Script
5
star
17

csp-fs

Implementation of Communicating Sequential Proccesses (CSP).
F#
5
star
18

swift-ble-macro

BLE (Bluetooth Low Energy) Macros for Swift
Swift
5
star
19

MemoryLeakPlayground

Swift
4
star
20

fnsh

A hobby project for new language like Bash (this project will be incomplete forever PROBABLY)
Isabelle
4
star
21

gulp-csslint-sourcemap-reporter

Console reporter adjusting error location by source map for the gulp-csslint module (https://www.npmjs.org/package/gulp-csslint)
JavaScript
4
star
22

slackit

Slackit is the bot framefork for Slack
JavaScript
3
star
23

Closure-annotation-for-JsDoc

The JsDoc plugin makes better JsDoc Annotations from Closure Annotations.
JavaScript
3
star
24

json-jsdoc

This is a JsDoc3 template publish JSON style doclets for each file. This template supports partial documentation.
JavaScript
3
star
25

isar-cheatsheet

Cheatsheet for Isabelle/Isar 2021
2
star
26

vim-prove-syntax

High visibility syntax for TAP by prove verbose output.
Vim Script
2
star
27

DelegateKit

Operators and Utilities for Delegates
Swift
2
star
28

tfmu-testing-framework-and-lint

2
star
29

tsumekusajsdoc

TsumekusaJsdoc is a Jsdoc3 template. The template is CUI oriented.
JavaScript
2
star
30

isabelle-program-semantics-exercise

「情報数学講座(第7巻)プログラム意味論」(著: 横内寛文)の形式的証明
Isabelle
2
star
31

Escape-Codec-Library-for-Closure

Escape Codec Library module conformed to Closure Library.
JavaScript
1
star
32

gulp-less-reporter

Error reporter for gulp-less
JavaScript
1
star
33

DIPlayground

Swift
1
star
34

doji-auth

Extended PIN Authentication Scheme by Allowing Multi-Touch Input.
JavaScript
1
star
35

isabelle-finite-bounded-lattice-is-complete-lattice

Isabelle
1
star
36

decode-receipt

in-App Purchase Receipt Decoder for CLI.
Ruby
1
star
37

StartSmallForAPI

Swift
1
star
38

idb-portable

Portable package buider for facebook/idb
Makefile
1
star
39

semantics-of-programing-yokouchi-exercise

Isabelle
1
star
40

WiFiQRCodeKitExampleApp

An example for WiFiQRCodeKit
Swift
1
star
41

doclink

Doclink is a JavaScript module provides to link doc comment to AST node as the link targets.
JavaScript
1
star
42

uec-takada-lab-thesis-styles

Takada Lab(UEC, Tokyo) Thesis Style Files (TeX+BibTeX)
TeX
1
star
43

closure-annotate-jsdoc3

The is a Jsdoc3 plugin make Closure Library (and Closure Compiler) style annotation available.
JavaScript
1
star
44

promised-params-collector

JavaScript
1
star
45

wordle

Wordle solver implemented by Prolog
Prolog
1
star
46

chai-stream

Extends Chai with assertions about streams.
JavaScript
1
star
47

reversi-pml

Model checker playground for https://github.com/Kuniwak/reversi-ios
sed
1
star