Skip to content

Commit c923dfc

Browse files
committed
fix unit testing for multi-platform module
1 parent a5936c1 commit c923dfc

7 files changed

Lines changed: 33 additions & 26 deletions

File tree

CoreStore.podspec

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,22 @@ Pod::Spec.new do |s|
1111

1212
s.ios.deployment_target = "13.0"
1313
s.osx.deployment_target = "10.15"
14-
s.watchos.deployment_target = "6.0"
1514
s.tvos.deployment_target = "13.0"
15+
s.watchos.deployment_target = "6.0"
1616

17-
s.source_files = "Sources", "Sources/**/*.{swift,h,m}"
17+
s.source_files = "Sources", "Sources/**/*.swift"
1818
s.public_header_files = "Sources/**/*.h"
1919
s.frameworks = "Foundation", "CoreData"
2020
s.requires_arc = true
2121
s.pod_target_xcconfig = { 'OTHER_SWIFT_FLAGS[config=Debug]' => '-D DEBUG', 'OTHER_LDFLAGS' => '-weak_framework Combine -weak_framework SwiftUI' }
22+
23+
s.test_spec "CoreStoreTests" do |ts|
24+
ts.source_files = "CoreStoreTests", "CoreStoreTests/**/*.swift", "CoreStoreTests/**/*.xcdatamodeld", "CoreStoreTests/**/*.xcdatamodel"
25+
ts.public_header_files = "CoreStoreTests/**/*.h"
26+
ts.resources = [ "CoreStoreTests/**/*.xcdatamodeld", "CoreStoreTests/**/*.xcdatamodel" ]
27+
ts.preserve_paths = "CoreStoreTests/**/*.xcdatamodeld"
28+
ts.frameworks = "Foundation", "CoreData"
29+
ts.requires_arc = true
30+
ts.platforms = { :ios => nil, :osx => nil, :tvos => nil, :watchos => nil }
31+
end
2232
end

CoreStore.xcodeproj/project.pbxproj

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -848,12 +848,12 @@
848848
remoteGlobalIDString = 82BA18881C4BBCBA00A0916E;
849849
remoteInfo = "CoreStore tvOS";
850850
};
851-
B5114DA528CEEE5400EEAE78 /* PBXContainerItemProxy */ = {
851+
B5114DCB28CF0C2B00EEAE78 /* PBXContainerItemProxy */ = {
852852
isa = PBXContainerItemProxy;
853853
containerPortal = 2F03A52719C5C6DA005002A5 /* Project object */;
854854
proxyType = 1;
855-
remoteGlobalIDString = 82BA18881C4BBCBA00A0916E;
856-
remoteInfo = "CoreStore tvOS";
855+
remoteGlobalIDString = B563216E1BD65082006C9394;
856+
remoteInfo = "CoreStore watchOS";
857857
};
858858
B52DD17F1BE1F8CD00949AFE /* PBXContainerItemProxy */ = {
859859
isa = PBXContainerItemProxy;
@@ -1878,7 +1878,7 @@
18781878
buildRules = (
18791879
);
18801880
dependencies = (
1881-
B5114DA428CEEE5400EEAE78 /* PBXTargetDependency */,
1881+
B5114DCC28CF0C2B00EEAE78 /* PBXTargetDependency */,
18821882
);
18831883
name = "CoreStoreTests watchOS";
18841884
productName = "CoreStore tvOSTests";
@@ -2935,10 +2935,10 @@
29352935
target = 82BA18881C4BBCBA00A0916E /* CoreStore tvOS */;
29362936
targetProxy = 82BA18941C4BBCBA00A0916E /* PBXContainerItemProxy */;
29372937
};
2938-
B5114DA428CEEE5400EEAE78 /* PBXTargetDependency */ = {
2938+
B5114DCC28CF0C2B00EEAE78 /* PBXTargetDependency */ = {
29392939
isa = PBXTargetDependency;
2940-
target = 82BA18881C4BBCBA00A0916E /* CoreStore tvOS */;
2941-
targetProxy = B5114DA528CEEE5400EEAE78 /* PBXContainerItemProxy */;
2940+
target = B563216E1BD65082006C9394 /* CoreStore watchOS */;
2941+
targetProxy = B5114DCB28CF0C2B00EEAE78 /* PBXContainerItemProxy */;
29422942
};
29432943
B52DD1801BE1F8CD00949AFE /* PBXTargetDependency */ = {
29442944
isa = PBXTargetDependency;

CoreStore.xcodeproj/xcshareddata/xcschemes/CoreStore watchOS.xcscheme

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<BuildableReference
3030
BuildableIdentifier = "primary"
3131
BlueprintIdentifier = "B5114DA328CEEE5400EEAE78"
32-
BuildableName = "CoreStoreTests watchOS.xctest"
32+
BuildableName = "CoreStoreTests.xctest"
3333
BlueprintName = "CoreStoreTests watchOS"
3434
ReferencedContainer = "container:CoreStore.xcodeproj">
3535
</BuildableReference>
@@ -47,7 +47,7 @@
4747
<BuildableReference
4848
BuildableIdentifier = "primary"
4949
BlueprintIdentifier = "B5114DA328CEEE5400EEAE78"
50-
BuildableName = "CoreStoreTests watchOS.xctest"
50+
BuildableName = "CoreStoreTests.xctest"
5151
BlueprintName = "CoreStoreTests watchOS"
5252
ReferencedContainer = "container:CoreStore.xcodeproj">
5353
</BuildableReference>

CoreStoreTests/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>BNDL</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>6.2.1</string>
18+
<string>9.0.0</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>

CoreStoreTests/ListObserverTests.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ class ListObserverTests: BaseTestDataTestCase {
103103

104104
let indexPath = userInfo?["indexPath"] as? IndexPath
105105
XCTAssertEqual(indexPath?.section, 0)
106-
XCTAssertEqual(indexPath?.row, 0)
106+
XCTAssertEqual(indexPath?.item, 0)
107107

108108
let object = userInfo?["object"] as? TestEntity1
109109
XCTAssertEqual(object?.testBoolean, NSNumber(value: true))
@@ -220,7 +220,7 @@ class ListObserverTests: BaseTestDataTestCase {
220220

221221
case NSNumber(value: 101)?:
222222
XCTAssertEqual(indexPath?.section, 1)
223-
XCTAssertEqual(indexPath?.row, 0)
223+
XCTAssertEqual(indexPath?.item, 0)
224224

225225
XCTAssertEqual(object?.testBoolean, NSNumber(value: true))
226226
XCTAssertEqual(object?.testNumber, NSNumber(value: 11))
@@ -231,7 +231,7 @@ class ListObserverTests: BaseTestDataTestCase {
231231

232232
case NSNumber(value: 102)?:
233233
XCTAssertEqual(indexPath?.section, 0)
234-
XCTAssertEqual(indexPath?.row, 0)
234+
XCTAssertEqual(indexPath?.item, 0)
235235

236236
XCTAssertEqual(object?.testBoolean, NSNumber(value: false))
237237
XCTAssertEqual(object?.testNumber, NSNumber(value: 22))
@@ -359,11 +359,11 @@ class ListObserverTests: BaseTestDataTestCase {
359359

360360
let fromIndexPath = userInfo?["fromIndexPath"] as? IndexPath
361361
XCTAssertEqual(fromIndexPath?.section, 0)
362-
XCTAssertEqual(fromIndexPath?.row, 0)
362+
XCTAssertEqual(fromIndexPath?.item, 0)
363363

364364
let toIndexPath = userInfo?["toIndexPath"] as? IndexPath
365365
XCTAssertEqual(toIndexPath?.section, 1)
366-
XCTAssertEqual(toIndexPath?.row, 1)
366+
XCTAssertEqual(toIndexPath?.item, 1)
367367

368368
let object = userInfo?["object"] as? TestEntity1
369369
XCTAssertEqual(object?.testEntityID, NSNumber(value: 102))
@@ -468,7 +468,7 @@ class ListObserverTests: BaseTestDataTestCase {
468468
let indexPath = userInfo?["indexPath"] as? IndexPath
469469

470470
XCTAssertEqual(indexPath?.section, 0)
471-
XCTAssert(indexPath?.row == 0 || indexPath?.row == 1)
471+
XCTAssert(indexPath?.item == 0 || indexPath?.item == 1)
472472

473473
let object = userInfo?["object"] as? TestEntity1
474474
XCTAssertEqual(object?.isDeleted, true)

CoreStoreTests/Model.xcdatamodeld/Model.xcdatamodel/contents

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2-
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="14460.32" systemVersion="17G2307" minimumToolsVersion="Xcode 4.3" sourceLanguage="Objective-C" userDefinedModelVersionIdentifier="">
3-
<entity name="TestEntity1AAA" representedClassName="CoreStoreTests.TestEntity1" syncable="YES">
2+
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="21279" systemVersion="21G83" minimumToolsVersion="Xcode 4.3" sourceLanguage="Objective-C" userDefinedModelVersionIdentifier="">
3+
<entity name="TestEntity1AAA" representedClassName=".TestEntity1" syncable="YES">
44
<attribute name="testBoolean" optional="YES" attributeType="Boolean" usesScalarValueType="NO" syncable="YES"/>
55
<attribute name="testData" optional="YES" attributeType="Binary" syncable="YES"/>
66
<attribute name="testDate" optional="YES" attributeType="Date" usesScalarValueType="NO" syncable="YES"/>
@@ -12,7 +12,7 @@
1212
<relationship name="testToManyUnordered" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="TestEntity1AAA" inverseName="testToOne" inverseEntity="TestEntity1AAA" syncable="YES"/>
1313
<relationship name="testToOne" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="TestEntity1AAA" inverseName="testToManyUnordered" inverseEntity="TestEntity1AAA" syncable="YES"/>
1414
</entity>
15-
<entity name="TestEntity2" representedClassName="CoreStoreTests.TestEntity2" syncable="YES">
15+
<entity name="TestEntity2" representedClassName=".TestEntity2" syncable="YES">
1616
<attribute name="testBoolean" optional="YES" attributeType="Boolean" usesScalarValueType="NO" syncable="YES"/>
1717
<attribute name="testData" optional="YES" attributeType="Binary" syncable="YES"/>
1818
<attribute name="testDate" optional="YES" attributeType="Date" usesScalarValueType="NO" syncable="YES"/>
@@ -30,8 +30,4 @@
3030
<configuration name="Config2">
3131
<memberEntity name="TestEntity2"/>
3232
</configuration>
33-
<elements>
34-
<element name="TestEntity1AAA" positionX="-63" positionY="-18" width="128" height="195"/>
35-
<element name="TestEntity2" positionX="-63" positionY="9" width="128" height="195"/>
36-
</elements>
3733
</model>

CoreStoreTests/TransactionTests.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
// SOFTWARE.
2424
//
2525

26+
import Foundation
2627
import XCTest
2728

2829
@testable
@@ -428,7 +429,7 @@ final class TransactionTests: BaseTestCase {
428429

429430
let indexPath = userInfo?["indexPath"] as? IndexPath
430431
XCTAssertEqual(indexPath?.section, 0)
431-
XCTAssertEqual(indexPath?.row, 0)
432+
XCTAssertEqual(indexPath?.item, 0)
432433

433434
let object = userInfo?["object"] as? TestEntity1
434435
XCTAssertEqual(object?.testBoolean, NSNumber(value: true))

0 commit comments

Comments
 (0)