WIP: Unit tests

This commit is contained in:
John Rommel Estropia
2016-06-04 14:29:10 +09:00
parent b199f38b0c
commit fcca6b205e
14 changed files with 1686 additions and 191 deletions

View File

@@ -96,31 +96,25 @@ public final class CSUnsafeDataTransaction: CSBaseDataTransaction {
Immediately flushes all pending changes to the transaction's observers. This is useful in conjunction with `ListMonitor`s and `ObjectMonitor`s created from `UnsafeDataTransaction`s used to manage temporary "scratch" data.
- Important: Note that unlike `commit()`, `flush()` does not propagate/save updates to the `DataStack` and the persistent store. However, the flushed changes will be seen by children transactions created further from the current transaction (i.e. through `transaction.beginUnsafe()`)
- parameter error: the `NSError` pointer that indicates the reason in case of an failure
*/
@objc
public func flush(error error: NSErrorPointer) {
public func flush() {
bridge(error) {
try self.bridgeToSwift.flush()
}
self.bridgeToSwift.flush()
}
/**
Flushes all pending changes to the transaction's observers at the end of the `closure`'s execution. This is useful in conjunction with `ListMonitor`s and `ObjectMonitor`s created from `UnsafeDataTransaction`s used to manage temporary "scratch" data.
- Important: Note that unlike `commit()`, `flush()` does not propagate/save updates to the `DataStack` and the persistent store. However, the flushed changes will be seen by children transactions created further from the current transaction (i.e. through `transaction.beginUnsafe()`)
- parameter error: the `NSError` pointer that indicates the reason in case of an failure
- parameter closure: the closure where changes can be made prior to the flush
*/
@objc
public func flush(error error: NSErrorPointer, block: () -> Void) throws {
public func flush(block: () -> Void) {
bridge(error) {
self.bridgeToSwift.flush {
block()
try self.bridgeToSwift.context.save()
}
}