Skip to content

Commit 266100d

Browse files
committed
Fix tests for Xcode 8 GM
1 parent defb8dd commit 266100d

File tree

2 files changed

+21
-9
lines changed

2 files changed

+21
-9
lines changed

.travis.yml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,25 @@ 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-
5+
- PLATFORM=Mac
6+
- PLATFORM=iOS NAME='iPhone SE'
7+
- PLATFORM=tvOS NAME='Apple TV 1080p'
8+
9+
before_install:
10+
- if [ -n "$NAME" ]; then
11+
export UUID=$(instruments -s | ruby -e "ARGF.each_line{ |ln| ln =~ /$NAME .* \[(.*)\]/; if \$1; puts(\$1); exit; end }");
12+
fi
13+
914
install:
1015
- carthage bootstrap --platform $PLATFORM
1116

1217
script:
13-
- if [ -n "$UUID" ]; then xcrun instruments -w "$UUID" || true; sleep 15; fi
14-
- set -o pipefail && xcodebuild -scheme PMKMapKit -destination "$DESTINATION" $ACTION | xcpretty
18+
- set -o pipefail;
19+
case $PLATFORM in
20+
Mac)
21+
xcodebuild -scheme PMKMapKit test | xcpretty;;
22+
iOS|tvOS)
23+
xcrun instruments -w "$UUID";
24+
sleep 15;
25+
xcodebuild -scheme PMKMapKit -destination "id=$UUID" test | xcpretty;;
26+
esac

Tests/TestMapKit.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class Test_MKDirections_Swift: XCTestCase {
88
let ex = expectation(description: "")
99

1010
class MockDirections: MKDirections {
11-
private override func calculate(completionHandler: MKDirectionsHandler) {
11+
private override func calculate(completionHandler: @escaping MKDirectionsHandler) {
1212
completionHandler(MKDirectionsResponse(), nil)
1313
}
1414
}
@@ -28,7 +28,7 @@ class Test_MKDirections_Swift: XCTestCase {
2828
let ex = expectation(description: "")
2929

3030
class MockDirections: MKDirections {
31-
private override func calculateETA(completionHandler: MKETAHandler) {
31+
private override func calculateETA(completionHandler: @escaping MKETAHandler) {
3232
completionHandler(MKETAResponse(), nil)
3333
}
3434
}
@@ -48,7 +48,7 @@ class Test_MKSnapshotter_Swift: XCTestCase {
4848
let ex = expectation(description: "")
4949

5050
class MockSnapshotter: MKMapSnapshotter {
51-
private override func start(completionHandler: MKMapSnapshotCompletionHandler) {
51+
private override func start(completionHandler: @escaping MKMapSnapshotCompletionHandler) {
5252
completionHandler(MKMapSnapshot(), nil)
5353
}
5454
}

0 commit comments

Comments
 (0)