mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-03-22 01:19:42 +01:00
WIP: Unit tests
This commit is contained in:
@@ -75,6 +75,10 @@ public struct Into<T: NSManagedObject>: Hashable {
|
||||
*/
|
||||
public init(_ entityClass: AnyClass) {
|
||||
|
||||
CoreStore.assert(
|
||||
entityClass is T.Type,
|
||||
"Attempted to create generic type \(cs_typeName(Into<T>)) with entity class \(cs_typeName(entityClass))"
|
||||
)
|
||||
self.init(entityClass: entityClass, configuration: nil, inferStoreIfPossible: true)
|
||||
}
|
||||
|
||||
@@ -116,6 +120,10 @@ public struct Into<T: NSManagedObject>: Hashable {
|
||||
*/
|
||||
public init(_ entityClass: AnyClass, _ configuration: String?) {
|
||||
|
||||
CoreStore.assert(
|
||||
entityClass is T.Type,
|
||||
"Attempted to create generic type \(cs_typeName(Into<T>)) with entity class \(cs_typeName(entityClass))"
|
||||
)
|
||||
self.init(entityClass: entityClass, configuration: configuration, inferStoreIfPossible: false)
|
||||
}
|
||||
|
||||
@@ -171,3 +179,11 @@ public func == <T: NSManagedObject, U: NSManagedObject>(lhs: Into<T>, rhs: Into<
|
||||
&& lhs.configuration == rhs.configuration
|
||||
&& lhs.inferStoreIfPossible == rhs.inferStoreIfPossible
|
||||
}
|
||||
|
||||
@warn_unused_result
|
||||
public func != <T: NSManagedObject, U: NSManagedObject>(lhs: Into<T>, rhs: Into<U>) -> Bool {
|
||||
|
||||
return lhs.entityClass == rhs.entityClass
|
||||
&& lhs.configuration == rhs.configuration
|
||||
&& lhs.inferStoreIfPossible == rhs.inferStoreIfPossible
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user