Skip to content

Commit 0449120

Browse files
committed
Fix tests with Xcode 8 GM
1 parent bc3e9c9 commit 0449120

File tree

2 files changed

+24
-10
lines changed

2 files changed

+24
-10
lines changed

.travis.yml

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,28 @@ language: objective-c
22
osx_image: xcode8
33

44
env:
5-
- ACTION=test PLATFORM=Mac DESTINATION='platform=OS X'
6-
- ACTION=test PLATFORM=iOS DESTINATION='platform=iOS Simulator,name=iPhone 6S' UUID='7FC06F6D-AF72-4B38-9A96-1F934EA2E27F'
7-
- ACTION=test PLATFORM=tvOS DESTINATION='platform=tvOS Simulator,name=Apple TV 1080p' UUID='0DF1B136-A3A7-4C51-AE6E-CFEFDF52DA24'
8-
- ACTION=build PLATFORM=watchOS DESTINATION='platform=watchOS Simulator,name=Apple Watch - 38mm'
9-
5+
- PLATFORM=Mac
6+
- PLATFORM=iOS NAME='iPhone SE'
7+
- PLATFORM=tvOS NAME='Apple TV 1080p'
8+
- PLATFORM=watchOS
9+
10+
before_install:
11+
- if [ -n "$NAME" ]; then
12+
export UUID=$(instruments -s | ruby -e "ARGF.each_line{ |ln| ln =~ /$NAME .* \[(.*)\]/; if \$1; puts(\$1); exit; end }");
13+
fi
14+
1015
install:
1116
- carthage bootstrap --platform $PLATFORM
1217

1318
script:
14-
- if [ -n "$UUID" ]; then xcrun instruments -w "$UUID" || true; sleep 15; fi
15-
- set -o pipefail && xcodebuild -scheme PMKCoreLocation -destination "$DESTINATION" $ACTION | xcpretty
19+
- set -o pipefail;
20+
case $PLATFORM in
21+
Mac)
22+
xcodebuild -scheme PMKCoreLocation test | xcpretty;;
23+
iOS|tvOS)
24+
xcrun instruments -w "$UUID";
25+
sleep 15;
26+
xcodebuild -scheme PMKCoreLocation -destination "id=$UUID" test | xcpretty;;
27+
watchOS)
28+
xcodebuild -scheme PMKCoreLocation -destination "name=Apple Watch - 38mm" | xcpretty;;
29+
esac

Tests/CLGeocoderTests.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import XCTest
66
class CLGeocoderTests: XCTestCase {
77
func test_reverseGeocodeLocation() {
88
class MockGeocoder: CLGeocoder {
9-
private override func reverseGeocodeLocation(_ location: CLLocation, completionHandler: CLGeocodeCompletionHandler) {
9+
private override func reverseGeocodeLocation(_ location: CLLocation, completionHandler: @escaping CLGeocodeCompletionHandler) {
1010
after(interval: 0).then {
1111
completionHandler([dummyPlacemark], nil)
1212
}
@@ -24,7 +24,7 @@ class CLGeocoderTests: XCTestCase {
2424
func test_geocodeAddressDictionary() {
2525
class MockGeocoder: CLGeocoder {
2626

27-
private override func geocodeAddressDictionary(_ addressDictionary: [AnyHashable : Any], completionHandler: CLGeocodeCompletionHandler) {
27+
private override func geocodeAddressDictionary(_ addressDictionary: [AnyHashable : Any], completionHandler: @escaping CLGeocodeCompletionHandler) {
2828
after(interval: 0.0).then {
2929
completionHandler([dummyPlacemark], nil)
3030
}
@@ -41,7 +41,7 @@ class CLGeocoderTests: XCTestCase {
4141

4242
func test_geocodeAddressString() {
4343
class MockGeocoder: CLGeocoder {
44-
override func geocodeAddressString(_ addressString: String, completionHandler: CLGeocodeCompletionHandler) {
44+
override func geocodeAddressString(_ addressString: String, completionHandler: @escaping CLGeocodeCompletionHandler) {
4545
after(interval: 0.0).then {
4646
completionHandler([dummyPlacemark], nil)
4747
}

0 commit comments

Comments
 (0)