Skip to content

Commit 539219b

Browse files
author
Itai Ferber
committed
Fix availability statements in CodableTests.swift
1 parent d7ff0a3 commit 539219b

File tree

1 file changed

+23
-20
lines changed

1 file changed

+23
-20
lines changed

test/stdlib/CodableTests.swift

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class TestCodableSuper { }
2222
#endif
2323

2424
// MARK: - Helper Functions
25-
@available(OSX 10.11, iOS 9.0, *)
25+
@available(macOS 10.11, iOS 9.0, watchOS 2.0, tvOS 9.0, *)
2626
func makePersonNameComponents(namePrefix: String? = nil,
2727
givenName: String? = nil,
2828
middleName: String? = nil,
@@ -220,7 +220,7 @@ class TestCodable : TestCodableSuper {
220220
#line : CGAffineTransform(a: 0.498, b: -0.284, c: -0.742, d: 0.3248, tx: 12, ty: 44)
221221
]
222222

223-
if #available(OSX 10.13, iOS 11.0, watchOS 4.0, tvOS 11.0, *) {
223+
if #available(macOS 10.13, iOS 11.0, watchOS 4.0, tvOS 11.0, *) {
224224
values[#line] = CGAffineTransform(rotationAngle: .pi / 2)
225225
}
226226

@@ -246,7 +246,7 @@ class TestCodable : TestCodableSuper {
246246
#line : CGPoint(x: 10, y: 20)
247247
]
248248

249-
if #available(OSX 10.13, iOS 11.0, watchOS 4.0, tvOS 11.0, *) {
249+
if #available(macOS 10.13, iOS 11.0, watchOS 4.0, tvOS 11.0, *) {
250250
// Limit on magnitude in JSON. See rdar://problem/12717407
251251
values[#line] = CGPoint(x: CGFloat.greatestFiniteMagnitude,
252252
y: CGFloat.greatestFiniteMagnitude)
@@ -274,7 +274,7 @@ class TestCodable : TestCodableSuper {
274274
#line : CGSize(width: 30, height: 40)
275275
]
276276

277-
if #available(OSX 10.13, iOS 11.0, watchOS 4.0, tvOS 11.0, *) {
277+
if #available(macOS 10.13, iOS 11.0, watchOS 4.0, tvOS 11.0, *) {
278278
// Limit on magnitude in JSON. See rdar://problem/12717407
279279
values[#line] = CGSize(width: CGFloat.greatestFiniteMagnitude,
280280
height: CGFloat.greatestFiniteMagnitude)
@@ -303,7 +303,7 @@ class TestCodable : TestCodableSuper {
303303
#line : CGRect(x: 10, y: 20, width: 30, height: 40)
304304
]
305305

306-
if #available(OSX 10.13, iOS 11.0, watchOS 4.0, tvOS 11.0, *) {
306+
if #available(macOS 10.13, iOS 11.0, watchOS 4.0, tvOS 11.0, *) {
307307
// Limit on magnitude in JSON. See rdar://problem/12717407
308308
values[#line] = CGRect.infinite
309309
}
@@ -330,7 +330,7 @@ class TestCodable : TestCodableSuper {
330330
#line : CGVector(dx: 0.0, dy: -9.81)
331331
]
332332

333-
if #available(OSX 10.13, iOS 11.0, watchOS 4.0, tvOS 11.0, *) {
333+
if #available(macOS 10.13, iOS 11.0, watchOS 4.0, tvOS 11.0, *) {
334334
// Limit on magnitude in JSON. See rdar://problem/12717407
335335
values[#line] = CGVector(dx: CGFloat.greatestFiniteMagnitude,
336336
dy: CGFloat.greatestFiniteMagnitude)
@@ -371,22 +371,22 @@ class TestCodable : TestCodableSuper {
371371
}
372372

373373
// MARK: - DateInterval
374-
@available(OSX 10.12, iOS 10.10, watchOS 3.0, tvOS 10.0, *)
374+
@available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
375375
lazy var dateIntervalValues: [Int : DateInterval] = [
376376
#line : DateInterval(),
377377
#line : DateInterval(start: Date.distantPast, end: Date()),
378378
#line : DateInterval(start: Date(), end: Date.distantFuture),
379379
#line : DateInterval(start: Date.distantPast, end: Date.distantFuture)
380380
]
381381

382-
@available(OSX 10.12, iOS 10.10, watchOS 3.0, tvOS 10.0, *)
382+
@available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
383383
func test_DateInterval_JSON() {
384384
for (testLine, interval) in dateIntervalValues {
385385
expectRoundTripEqualityThroughJSON(for: interval, lineNumber: testLine)
386386
}
387387
}
388388

389-
@available(OSX 10.12, iOS 10.10, watchOS 3.0, tvOS 10.0, *)
389+
@available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
390390
func test_DateInterval_Plist() {
391391
for (testLine, interval) in dateIntervalValues {
392392
expectRoundTripEqualityThroughPlist(for: interval, lineNumber: testLine)
@@ -482,21 +482,21 @@ class TestCodable : TestCodableSuper {
482482
}
483483

484484
// MARK: - Measurement
485-
@available(OSX 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
485+
@available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
486486
lazy var unitValues: [Int : Dimension] = [
487487
#line : UnitAcceleration.metersPerSecondSquared,
488488
#line : UnitMass.kilograms,
489489
#line : UnitLength.miles
490490
]
491491

492-
@available(OSX 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
492+
@available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
493493
func test_Measurement_JSON() {
494494
for (testLine, unit) in unitValues {
495495
expectRoundTripEqualityThroughJSON(for: Measurement(value: 42, unit: unit), lineNumber: testLine)
496496
}
497497
}
498498

499-
@available(OSX 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
499+
@available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
500500
func test_Measurement_Plist() {
501501
for (testLine, unit) in unitValues {
502502
expectRoundTripEqualityThroughJSON(for: Measurement(value: 42, unit: unit), lineNumber: testLine)
@@ -523,21 +523,21 @@ class TestCodable : TestCodableSuper {
523523
}
524524

525525
// MARK: - PersonNameComponents
526-
@available(OSX 10.11, iOS 9.0, *)
526+
@available(macOS 10.11, iOS 9.0, watchOS 2.0, tvOS 9.0, *)
527527
lazy var personNameComponentsValues: [Int : PersonNameComponents] = [
528528
#line : makePersonNameComponents(givenName: "John", familyName: "Appleseed"),
529529
#line : makePersonNameComponents(givenName: "John", familyName: "Appleseed", nickname: "Johnny"),
530530
#line : makePersonNameComponents(namePrefix: "Dr.", givenName: "Jane", middleName: "A.", familyName: "Appleseed", nameSuffix: "Esq.", nickname: "Janie")
531531
]
532532

533-
@available(OSX 10.11, iOS 9.0, *)
533+
@available(macOS 10.11, iOS 9.0, watchOS 2.0, tvOS 9.0, *)
534534
func test_PersonNameComponents_JSON() {
535535
for (testLine, components) in personNameComponentsValues {
536536
expectRoundTripEqualityThroughJSON(for: components, lineNumber: testLine)
537537
}
538538
}
539539

540-
@available(OSX 10.11, iOS 9.0, *)
540+
@available(macOS 10.11, iOS 9.0, watchOS 2.0, tvOS 9.0, *)
541541
func test_PersonNameComponents_Plist() {
542542
for (testLine, components) in personNameComponentsValues {
543543
expectRoundTripEqualityThroughPlist(for: components, lineNumber: testLine)
@@ -572,7 +572,7 @@ class TestCodable : TestCodableSuper {
572572
#line : URL(string: "documentation", relativeTo: URL(string: "http://swift.org")!)!
573573
]
574574

575-
if #available(OSX 10.11, iOS 9.0, *) {
575+
if #available(macOS 10.11, iOS 9.0, watchOS 2.0, tvOS 9.0, *) {
576576
values[#line] = URL(fileURLWithPath: "bin/sh", relativeTo: URL(fileURLWithPath: "/"))
577577
}
578578

@@ -770,8 +770,6 @@ var tests = [
770770
"test_TimeZone_Plist" : TestCodable.test_TimeZone_Plist,
771771
"test_URL_JSON" : TestCodable.test_URL_JSON,
772772
"test_URL_Plist" : TestCodable.test_URL_Plist,
773-
"test_URLComponents_JSON" : TestCodable.test_URLComponents_JSON,
774-
"test_URLComponents_Plist" : TestCodable.test_URLComponents_Plist,
775773
"test_UUID_JSON" : TestCodable.test_UUID_JSON,
776774
"test_UUID_Plist" : TestCodable.test_UUID_Plist,
777775
]
@@ -781,18 +779,23 @@ var tests = [
781779
tests["test_AffineTransform_Plist"] = TestCodable.test_AffineTransform_Plist
782780
#endif
783781

784-
if #available(OSX 10.11, iOS 9.0, *) {
782+
if #available(macOS 10.11, iOS 9.0, watchOS 2.0, tvOS 9.0, *) {
785783
tests["test_PersonNameComponents_JSON"] = TestCodable.test_PersonNameComponents_JSON
786784
tests["test_PersonNameComponents_Plist"] = TestCodable.test_PersonNameComponents_Plist
787785
}
788786

789-
if #available(OSX 10.12, iOS 10.10, watchOS 3.0, tvOS 10.0, *) {
787+
if #available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *) {
790788
// tests["test_DateInterval_JSON"] = TestCodable.test_DateInterval_JSON
791789
tests["test_DateInterval_Plist"] = TestCodable.test_DateInterval_Plist
792790
// tests["test_Measurement_JSON"] = TestCodable.test_Measurement_JSON
793791
// tests["test_Measurement_Plist"] = TestCodable.test_Measurement_Plist
794792
}
795793

794+
if #available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *) {
795+
tests["test_URLComponents_JSON"] = TestCodable.test_URLComponents_JSON
796+
tests["test_URLComponents_Plist"] = TestCodable.test_URLComponents_Plist
797+
}
798+
796799
var CodableTests = TestSuite("TestCodable")
797800
for (name, test) in tests {
798801
CodableTests.test(name) { test(TestCodable())() }

0 commit comments

Comments
 (0)