fix unit testing for multi-platform module

This commit is contained in:
John Estropia
2022-09-12 16:51:20 +09:00
parent a5936c1120
commit c923dfc12c
7 changed files with 33 additions and 26 deletions

View File

@@ -11,12 +11,22 @@ Pod::Spec.new do |s|
s.ios.deployment_target = "13.0"
s.osx.deployment_target = "10.15"
s.watchos.deployment_target = "6.0"
s.tvos.deployment_target = "13.0"
s.watchos.deployment_target = "6.0"
s.source_files = "Sources", "Sources/**/*.{swift,h,m}"
s.source_files = "Sources", "Sources/**/*.swift"
s.public_header_files = "Sources/**/*.h"
s.frameworks = "Foundation", "CoreData"
s.requires_arc = true
s.pod_target_xcconfig = { 'OTHER_SWIFT_FLAGS[config=Debug]' => '-D DEBUG', 'OTHER_LDFLAGS' => '-weak_framework Combine -weak_framework SwiftUI' }
s.test_spec "CoreStoreTests" do |ts|
ts.source_files = "CoreStoreTests", "CoreStoreTests/**/*.swift", "CoreStoreTests/**/*.xcdatamodeld", "CoreStoreTests/**/*.xcdatamodel"
ts.public_header_files = "CoreStoreTests/**/*.h"
ts.resources = [ "CoreStoreTests/**/*.xcdatamodeld", "CoreStoreTests/**/*.xcdatamodel" ]
ts.preserve_paths = "CoreStoreTests/**/*.xcdatamodeld"
ts.frameworks = "Foundation", "CoreData"
ts.requires_arc = true
ts.platforms = { :ios => nil, :osx => nil, :tvos => nil, :watchos => nil }
end
end

View File

@@ -848,12 +848,12 @@
remoteGlobalIDString = 82BA18881C4BBCBA00A0916E;
remoteInfo = "CoreStore tvOS";
};
B5114DA528CEEE5400EEAE78 /* PBXContainerItemProxy */ = {
B5114DCB28CF0C2B00EEAE78 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 2F03A52719C5C6DA005002A5 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 82BA18881C4BBCBA00A0916E;
remoteInfo = "CoreStore tvOS";
remoteGlobalIDString = B563216E1BD65082006C9394;
remoteInfo = "CoreStore watchOS";
};
B52DD17F1BE1F8CD00949AFE /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
@@ -1878,7 +1878,7 @@
buildRules = (
);
dependencies = (
B5114DA428CEEE5400EEAE78 /* PBXTargetDependency */,
B5114DCC28CF0C2B00EEAE78 /* PBXTargetDependency */,
);
name = "CoreStoreTests watchOS";
productName = "CoreStore tvOSTests";
@@ -2935,10 +2935,10 @@
target = 82BA18881C4BBCBA00A0916E /* CoreStore tvOS */;
targetProxy = 82BA18941C4BBCBA00A0916E /* PBXContainerItemProxy */;
};
B5114DA428CEEE5400EEAE78 /* PBXTargetDependency */ = {
B5114DCC28CF0C2B00EEAE78 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 82BA18881C4BBCBA00A0916E /* CoreStore tvOS */;
targetProxy = B5114DA528CEEE5400EEAE78 /* PBXContainerItemProxy */;
target = B563216E1BD65082006C9394 /* CoreStore watchOS */;
targetProxy = B5114DCB28CF0C2B00EEAE78 /* PBXContainerItemProxy */;
};
B52DD1801BE1F8CD00949AFE /* PBXTargetDependency */ = {
isa = PBXTargetDependency;

View File

@@ -29,7 +29,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B5114DA328CEEE5400EEAE78"
BuildableName = "CoreStoreTests watchOS.xctest"
BuildableName = "CoreStoreTests.xctest"
BlueprintName = "CoreStoreTests watchOS"
ReferencedContainer = "container:CoreStore.xcodeproj">
</BuildableReference>
@@ -47,7 +47,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B5114DA328CEEE5400EEAE78"
BuildableName = "CoreStoreTests watchOS.xctest"
BuildableName = "CoreStoreTests.xctest"
BlueprintName = "CoreStoreTests watchOS"
ReferencedContainer = "container:CoreStore.xcodeproj">
</BuildableReference>

View File

@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>6.2.1</string>
<string>9.0.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>

View File

@@ -103,7 +103,7 @@ class ListObserverTests: BaseTestDataTestCase {
let indexPath = userInfo?["indexPath"] as? IndexPath
XCTAssertEqual(indexPath?.section, 0)
XCTAssertEqual(indexPath?.row, 0)
XCTAssertEqual(indexPath?.item, 0)
let object = userInfo?["object"] as? TestEntity1
XCTAssertEqual(object?.testBoolean, NSNumber(value: true))
@@ -220,7 +220,7 @@ class ListObserverTests: BaseTestDataTestCase {
case NSNumber(value: 101)?:
XCTAssertEqual(indexPath?.section, 1)
XCTAssertEqual(indexPath?.row, 0)
XCTAssertEqual(indexPath?.item, 0)
XCTAssertEqual(object?.testBoolean, NSNumber(value: true))
XCTAssertEqual(object?.testNumber, NSNumber(value: 11))
@@ -231,7 +231,7 @@ class ListObserverTests: BaseTestDataTestCase {
case NSNumber(value: 102)?:
XCTAssertEqual(indexPath?.section, 0)
XCTAssertEqual(indexPath?.row, 0)
XCTAssertEqual(indexPath?.item, 0)
XCTAssertEqual(object?.testBoolean, NSNumber(value: false))
XCTAssertEqual(object?.testNumber, NSNumber(value: 22))
@@ -359,11 +359,11 @@ class ListObserverTests: BaseTestDataTestCase {
let fromIndexPath = userInfo?["fromIndexPath"] as? IndexPath
XCTAssertEqual(fromIndexPath?.section, 0)
XCTAssertEqual(fromIndexPath?.row, 0)
XCTAssertEqual(fromIndexPath?.item, 0)
let toIndexPath = userInfo?["toIndexPath"] as? IndexPath
XCTAssertEqual(toIndexPath?.section, 1)
XCTAssertEqual(toIndexPath?.row, 1)
XCTAssertEqual(toIndexPath?.item, 1)
let object = userInfo?["object"] as? TestEntity1
XCTAssertEqual(object?.testEntityID, NSNumber(value: 102))
@@ -468,7 +468,7 @@ class ListObserverTests: BaseTestDataTestCase {
let indexPath = userInfo?["indexPath"] as? IndexPath
XCTAssertEqual(indexPath?.section, 0)
XCTAssert(indexPath?.row == 0 || indexPath?.row == 1)
XCTAssert(indexPath?.item == 0 || indexPath?.item == 1)
let object = userInfo?["object"] as? TestEntity1
XCTAssertEqual(object?.isDeleted, true)

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="14460.32" systemVersion="17G2307" minimumToolsVersion="Xcode 4.3" sourceLanguage="Objective-C" userDefinedModelVersionIdentifier="">
<entity name="TestEntity1AAA" representedClassName="CoreStoreTests.TestEntity1" syncable="YES">
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="21279" systemVersion="21G83" minimumToolsVersion="Xcode 4.3" sourceLanguage="Objective-C" userDefinedModelVersionIdentifier="">
<entity name="TestEntity1AAA" representedClassName=".TestEntity1" syncable="YES">
<attribute name="testBoolean" optional="YES" attributeType="Boolean" usesScalarValueType="NO" syncable="YES"/>
<attribute name="testData" optional="YES" attributeType="Binary" syncable="YES"/>
<attribute name="testDate" optional="YES" attributeType="Date" usesScalarValueType="NO" syncable="YES"/>
@@ -12,7 +12,7 @@
<relationship name="testToManyUnordered" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="TestEntity1AAA" inverseName="testToOne" inverseEntity="TestEntity1AAA" syncable="YES"/>
<relationship name="testToOne" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="TestEntity1AAA" inverseName="testToManyUnordered" inverseEntity="TestEntity1AAA" syncable="YES"/>
</entity>
<entity name="TestEntity2" representedClassName="CoreStoreTests.TestEntity2" syncable="YES">
<entity name="TestEntity2" representedClassName=".TestEntity2" syncable="YES">
<attribute name="testBoolean" optional="YES" attributeType="Boolean" usesScalarValueType="NO" syncable="YES"/>
<attribute name="testData" optional="YES" attributeType="Binary" syncable="YES"/>
<attribute name="testDate" optional="YES" attributeType="Date" usesScalarValueType="NO" syncable="YES"/>
@@ -30,8 +30,4 @@
<configuration name="Config2">
<memberEntity name="TestEntity2"/>
</configuration>
<elements>
<element name="TestEntity1AAA" positionX="-63" positionY="-18" width="128" height="195"/>
<element name="TestEntity2" positionX="-63" positionY="9" width="128" height="195"/>
</elements>
</model>

View File

@@ -23,6 +23,7 @@
// SOFTWARE.
//
import Foundation
import XCTest
@testable
@@ -428,7 +429,7 @@ final class TransactionTests: BaseTestCase {
let indexPath = userInfo?["indexPath"] as? IndexPath
XCTAssertEqual(indexPath?.section, 0)
XCTAssertEqual(indexPath?.row, 0)
XCTAssertEqual(indexPath?.item, 0)
let object = userInfo?["object"] as? TestEntity1
XCTAssertEqual(object?.testBoolean, NSNumber(value: true))