1
1
mirror of https://github.com/github/semantic.git synced 2024-12-01 09:15:01 +03:00

Test that the before state is recoverable.

Apparently it is sometimes not!
This commit is contained in:
Rob Rix 2015-10-16 17:34:34 -04:00
parent 22fe4c4ebb
commit 20fa9ba32a

View File

@ -19,6 +19,15 @@ final class DiffTests: XCTestCase {
Free.equals(ifPure: Patch.equals(Cofree.equals(annotation: ==, leaf: ==)), ifRoll: ==)(diff.diff, diff.diff)
}
}
func testOriginalTermsAreRecoverable() {
let equal = Cofree<String, ()>.equals(annotation: const(true), leaf: ==)
property("before state is recoverable") <- forAll { (diff: RangedDiff) in
return diff.diff.map { $0.map { $0.map(const(())) } }.before.map {
equal($0, diff.a.map(const(())))
} ?? false
}
}
}