Skip to content

Commit 16d7d94

Browse files
committed
Availability annotations don’t work for tests
Make sense since the runtime is used to find the tests, and that is not Swift-aware. Can’t see any other way to do this. Fixes CI for iOS 8 tests since seemingly they didn’t back port the stubs for this function that far and it then fails. Frankly I don’t get it. Since the iOS 9 tests passed.
1 parent 5d4719c commit 16d7d94

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

Sources/CLGeocoder+Promise.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ extension CLGeocoder {
4848
#if !os(tvOS) && swift(>=3.2)
4949
/// Submits a forward-geocoding request using the specified postal address.
5050
@available(iOS 11.0, OSX 10.13, watchOS 4.0, *)
51-
@available(tvOS, unavailable)
5251
public func geocodePostalAddress(_ postalAddress: CNPostalAddress) -> Promise<[CLPlacemark]> {
5352
return Promise { seal in
5453
geocodePostalAddress(postalAddress, completionHandler: seal.resolve)

Tests/CLGeocoderTests.swift

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,35 +59,36 @@ class CLGeocoderTests: XCTestCase {
5959
}
6060

6161
#if !os(tvOS) && swift(>=3.2)
62-
@available(iOS 11.0, OSX 10.13, watchOS 4.0, *)
6362
func test_geocodePostalAddress() {
63+
guard #available(iOS 11.0, OSX 10.13, watchOS 4.0, *) else { return }
64+
6465
class MockGeocoder: CLGeocoder {
6566
override func geocodePostalAddress(_ postalAddress: CNPostalAddress, completionHandler: @escaping CLGeocodeCompletionHandler) {
6667
after(.seconds(0)).done {
6768
completionHandler([dummyPlacemark], nil)
6869
}
6970
}
7071
}
71-
72+
7273
let ex = expectation(description: "")
7374
MockGeocoder().geocodePostalAddress(CNPostalAddress()).done { x in
7475
XCTAssertEqual(x, [dummyPlacemark])
7576
ex.fulfill()
7677
}
7778
waitForExpectations(timeout: 1)
7879
}
79-
80-
@available(iOS 11.0, OSX 10.13, watchOS 4.0, *)
81-
@available(tvOS, unavailable)
80+
8281
func test_geocodePostalAddressLocale() {
82+
guard #available(iOS 11.0, OSX 10.13, watchOS 4.0, *) else { return }
83+
8384
class MockGeocoder: CLGeocoder {
8485
override func geocodePostalAddress(_ postalAddress: CNPostalAddress, preferredLocale locale: Locale?, completionHandler: @escaping CLGeocodeCompletionHandler) {
8586
after(.seconds(0)).done {
8687
completionHandler([dummyPlacemark], nil)
8788
}
8889
}
8990
}
90-
91+
9192
let ex = expectation(description: "")
9293
MockGeocoder().geocodePostalAddress(CNPostalAddress(), preferredLocale: nil).done { x in
9394
XCTAssertEqual(x, [dummyPlacemark])

0 commit comments

Comments
 (0)