Skip to content

Commit 5be886f

Browse files
[stdlib] Reinstate some tests (#36072)
1 parent 96cb756 commit 5be886f

File tree

4 files changed

+36
-38
lines changed

4 files changed

+36
-38
lines changed

test/stdlib/CodableTests.swift

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1-
// Copyright (c) 2014 - 2019 Apple Inc. and the Swift project authors
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// This source file is part of the Swift.org open source project
4+
//
5+
// Copyright (c) 2017 - 2021 Apple Inc. and the Swift project authors
26
// Licensed under Apache License v2.0 with Runtime Library Exception
37
//
48
// See https://swift.org/LICENSE.txt for license information
59
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
610
//
711
//===----------------------------------------------------------------------===//
8-
//
912
// RUN: %target-run-simple-swift
1013
// REQUIRES: executable_test
1114
// REQUIRES: objc_interop
12-
// REQUIRES: rdar49026133
1315

1416
import Foundation
1517
import CoreGraphics
@@ -544,14 +546,22 @@ class TestCodable : TestCodableSuper {
544546
@available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
545547
func test_Measurement_JSON() {
546548
for (testLine, unit) in unitValues {
549+
// FIXME: <rdar://problem/49026133>
550+
// Terminating due to uncaught exception NSInvalidArgumentException:
551+
// *** You must override baseUnit in your class NSDimension to define its base unit.
552+
expectCrashLater()
547553
expectRoundTripEqualityThroughJSON(for: Measurement(value: 42, unit: unit), lineNumber: testLine)
548554
}
549555
}
550556

551557
@available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
552558
func test_Measurement_Plist() {
553559
for (testLine, unit) in unitValues {
554-
expectRoundTripEqualityThroughJSON(for: Measurement(value: 42, unit: unit), lineNumber: testLine)
560+
// FIXME: <rdar://problem/49026133>
561+
// Terminating due to uncaught exception NSInvalidArgumentException:
562+
// *** You must override baseUnit in your class NSDimension to define its base unit.
563+
expectCrashLater()
564+
expectRoundTripEqualityThroughPlist(for: Measurement(value: 42, unit: unit), lineNumber: testLine)
555565
}
556566
}
557567

@@ -915,10 +925,10 @@ if #available(macOS 10.11, iOS 9.0, watchOS 2.0, tvOS 9.0, *) {
915925
}
916926

917927
if #available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *) {
918-
// tests["test_DateInterval_JSON"] = TestCodable.test_DateInterval_JSON
928+
tests["test_DateInterval_JSON"] = TestCodable.test_DateInterval_JSON
919929
tests["test_DateInterval_Plist"] = TestCodable.test_DateInterval_Plist
920-
// tests["test_Measurement_JSON"] = TestCodable.test_Measurement_JSON
921-
// tests["test_Measurement_Plist"] = TestCodable.test_Measurement_Plist
930+
tests["test_Measurement_JSON"] = TestCodable.test_Measurement_JSON
931+
tests["test_Measurement_Plist"] = TestCodable.test_Measurement_Plist
922932
}
923933

924934
if #available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *) {

test/stdlib/FloatingPoint.swift.gyb

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
1-
// RUN: %empty-directory(%t)
2-
// RUN: %gyb %s -o %t/FloatingPoint.swift
3-
// RUN: %line-directive %t/FloatingPoint.swift -- %target-build-swift -parse-stdlib %t/FloatingPoint.swift -o %t/a.out
4-
// RUN: %target-codesign %t/a.out
5-
// RUN: %line-directive %t/FloatingPoint.swift -- %target-run %t/a.out
1+
// RUN: %target-run-simple-swiftgyb(-parse-stdlib)
62
// REQUIRES: executable_test
7-
// REQUIRES: rdar49026133
83

94
import Swift
105
import StdlibUnittest
@@ -118,17 +113,17 @@ FloatingPoint.test("BinaryFloatingPoint/genericIntegerConversion") {
118113
FloatingPoint.test("BinaryFloatingPoint/genericFloatingPointConversion") {
119114
func convert<
120115
T: BinaryFloatingPoint, U: BinaryFloatingPoint
121-
>(exactly value: T, to: U.Type) -> U { U(exactly: value) }
116+
>(exactly value: T, to: U.Type) -> U? { U(exactly: value) }
122117

123118
expectEqual(convert(exactly: 0 as Float, to: Double.self), 0.0)
124119
expectEqual(convert(exactly: -0.0 as Float, to: Double.self), -0.0)
125120
expectEqual(
126-
convert(exactly: -0.0 as Float, to: Double.self).sign,
121+
convert(exactly: -0.0 as Float, to: Double.self)?.sign,
127122
FloatingPointSign.minus)
128123
expectEqual(convert(exactly: 0 as Double, to: Float.self), 0.0 as Float)
129124
expectEqual(convert(exactly: -0.0 as Double, to: Float.self), -0.0 as Float)
130125
expectEqual(
131-
convert(exactly: -0.0 as Double, to: Float.self).sign,
126+
convert(exactly: -0.0 as Double, to: Float.self)?.sign,
132127
FloatingPointSign.minus)
133128
expectEqual(convert(exactly: 1 as Float, to: Double.self), 1.0)
134129
expectEqual(convert(exactly: -1 as Float, to: Double.self), -1.0)
@@ -827,10 +822,11 @@ FloatingPoint.test("${FloatSelf}/{Comparable,Hashable,Equatable}") {
827822
// If either lhs or rhs is signaling, or if both are quiet NaNs, the
828823
// result is a quiet NaN.
829824
if lhs.isSignalingNaN || rhs.isSignalingNaN || (lhs.isNaN && rhs.isNaN) {
830-
expectTrue(min.isQuietNaN)
831-
expectTrue(max.isQuietNaN)
832-
expectTrue(minMag.isQuietNaN)
833-
expectTrue(maxMag.isQuietNaN)
825+
// FIXME: <rdar://problem/48917925>
826+
// expectTrue(min.isQuietNaN)
827+
// expectTrue(max.isQuietNaN)
828+
// expectTrue(minMag.isQuietNaN)
829+
// expectTrue(maxMag.isQuietNaN)
834830
}
835831
// If only one of lhs and rhs is NaN, the result of the min/max
836832
// operations is always the other value. While contrary to all other

test/stdlib/SetTrapsObjC.swift

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
1-
// RUN: %empty-directory(%t)
2-
// RUN: %target-build-swift %s -o %t/a.out_Debug -Onone
3-
// RUN: %target-build-swift %s -o %t/a.out_Release -O
4-
//
5-
// RUN: %target-codesign %t/a.out_Debug
6-
// RUN: %target-codesign %t/a.out_Release
7-
// RUN: %target-run %t/a.out_Debug
8-
// RUN: %target-run %t/a.out_Release
1+
// RUN: %target-run-simple-swift(-Onone)
2+
// RUN: %target-run-simple-swift(-O)
93
// REQUIRES: executable_test
104
// REQUIRES: objc_interop
11-
// REQUIRES: rdar49026133
125

136
import StdlibUnittest
147
import Foundation

validation-test/stdlib/DictionaryTrapsObjC.swift

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
1-
// RUN: %empty-directory(%t)
2-
// RUN: %target-build-swift %s -o %t/a.out_Debug -Onone
3-
// RUN: %target-build-swift %s -o %t/a.out_Release -O
4-
// RUN: %target-codesign %t/a.out_Debug
5-
// RUN: %target-codesign %t/a.out_Release
6-
//
7-
// RUN: %target-run %t/a.out_Debug
8-
// RUN: %target-run %t/a.out_Release
1+
// RUN: %target-run-simple-swift(-Onone -DDEBUG)
2+
// RUN: %target-run-simple-swift(-O)
93
// REQUIRES: executable_test
104
// REQUIRES: objc_interop
11-
// REQUIRES: rdar49026133
125

136
import StdlibUnittest
147
import Foundation
@@ -205,6 +198,10 @@ DictionaryTraps.test("ForcedNonverbatimBridge.Value")
205198
_ = d1 as! Dictionary<NSObject, String>
206199
}
207200

201+
// FIXME: <https://bugs.swift.org/browse/SR-14282>
202+
// Segmentation fault: 11 (when compiling with optimizations).
203+
// While running pass #0 SILModuleTransform "SILGenCleanup".
204+
#if DEBUG
208205

209206
DictionaryTraps.test("ForcedVerbatimBridge.StringKey")
210207
.skip(.custom(
@@ -284,6 +281,8 @@ DictionaryTraps.test("ForcedVerbatimBridge.Value")
284281
}
285282
}
286283

284+
#endif // DEBUG
285+
287286
DictionaryTraps.test("Downcast.Verbatim")
288287
.skip(.custom(
289288
{ _isFastAssertConfiguration() },

0 commit comments

Comments
 (0)