Gardening: Migrate test suite to GH issues: stdlib

This commit is contained in:
Anthony Latsis
2022-09-05 03:40:54 +03:00
parent a8b83b4e06
commit 52ce15ee9d
26 changed files with 82 additions and 61 deletions

View File

@@ -485,7 +485,7 @@ tests.test("rdar://problem/27905230") {
}
tests.test("verbatimBridged/Base/withUnsafeBufferPointer") {
// https://bugs.swift.org/browse/SR-14663
// https://github.com/apple/swift/issues/57014
// This tests a bad precondition that was fixed in
// https://github.com/apple/swift/pull/37960
guard #available(SwiftStdlib 5.5, *) else { return }
@@ -504,7 +504,7 @@ tests.test("verbatimBridged/Base/withUnsafeBufferPointer") {
}
tests.test("verbatimBridged/AnyObject/withUnsafeBufferPointer") {
// https://bugs.swift.org/browse/SR-14663
// https://github.com/apple/swift/issues/57014
// This tests a bad precondition that was fixed in
// https://github.com/apple/swift/pull/37960
guard #available(SwiftStdlib 5.5, *) else { return }

View File

@@ -12,7 +12,8 @@ BundleTests.test("Bundle.bundleForNilClass") {
// Foundation implementation does. The patched version from
// ObjCRuntimeGetImageNameFromClass did not.
//
// SR-9188
// https://github.com/apple/swift/issues/51679
typealias BundleForClassFunc =
@convention(c) (AnyObject, Selector, AnyObject?) -> Bundle

View File

@@ -698,7 +698,7 @@ func conditionalCast<T>(_ x: Any, to: T.Type) -> T? {
return x as? T
}
// SR-1562
// https://github.com/apple/swift/issues/44171
ErrorBridgingTests.test("Error archetype identity") {
let myError = NSError(domain: "myErrorDomain", code: 0,
userInfo: [ "one" : 1 ])
@@ -723,7 +723,8 @@ ErrorBridgingTests.test("Error archetype identity") {
=== nsError)
}
// SR-9389
// https://github.com/apple/swift/issues/51855
class ParentA: NSObject {
@objc(ParentAError) enum Error: Int, Swift.Error {
case failed
@@ -794,7 +795,8 @@ ErrorBridgingTests.test("error-to-NSObject casts") {
}
}
// SR-7732: Casting CFError or NSError to Error results in a memory leak
// https://github.com/apple/swift-corelibs-foundation/issues/3701
// Casting 'CFError' or 'NSError' to 'Error' results in a memory leak
ErrorBridgingTests.test("NSError-to-Error casts") {
func should_not_leak_nserror() {
let something: Any? = NSError(domain: "Foo", code: 1)
@@ -821,11 +823,13 @@ ErrorBridgingTests.test("CFError-to-Error casts") {
}
}
// https://github.com/apple/swift/issues/51697
enum MyError: Error {
case someThing
}
ErrorBridgingTests.test("SR-9207 crash in failed cast to NSError") {
ErrorBridgingTests.test("Crash in failed cast to 'NSError'") {
if #available(SwiftStdlib 5.2, *) {
let error = MyError.someThing
@@ -837,7 +841,7 @@ ErrorBridgingTests.test("SR-9207 crash in failed cast to NSError") {
}
}
// SR-7652
// https://github.com/apple/swift/issues/50193
enum SwiftError: Error, CustomStringConvertible {
case something

View File

@@ -67,7 +67,7 @@ ImplicitlyUnwrappedOptionalTests.test("preferOptional") {
let j: Int = 1
if i != j {} // we should choose != for Optionals rather than forcing i
if i == j {} // we should choose == for Optionals rather than forcing i
// FIXME: https://bugs.swift.org/browse/SR-6988
// FIXME: https://github.com/apple/swift/issues/49536
// if i *^* j {} // we should choose *^* for Optionals rather than forcing i
}

View File

@@ -48,11 +48,14 @@ func negativeShift(_ u8: UInt8) {
_ = (u8 << -1)
}
func sr5176(description: String = "unambiguous Int32.init(bitPattern:)") {
// https://github.com/apple/swift/issues/47752
// Ambiguous 'Int32.init(bitPattern:)'
do {
_ = Int32(bitPattern: 0) // should compile without ambiguity
}
func sr6634(x: UnsafeBufferPointer<UInt8>) -> Int {
// https://github.com/apple/swift/issues/49183
func f_49183(x: UnsafeBufferPointer<UInt8>) -> Int {
return x.lazy.filter { $0 > 127 || $0 == 0 }.count // should be unambiguous
}

View File

@@ -776,7 +776,7 @@ tests.test("Remainder/DividingBy0") {
}
tests.test("RemainderReportingOverflow/DividingByMinusOne") {
// Work around SR-5964.
// Work around https://github.com/apple/swift/issues/48523.
func minusOne<T : SignedInteger>() -> T {
return -1 as T
}
@@ -844,7 +844,7 @@ tests.test("Strideable") {
expectEqual(dist(${u}Int.max, ${u}x), -10)
// FIXME: The compiler spuriously flags these as overflowing:
// https://bugs.swift.org/browse/SR-5882
// https://github.com/apple/swift/issues/48452
// expectEqual(${u}x.distance(to: ${u}Int.max), 10)
% end

View File

@@ -7,7 +7,8 @@
// REQUIRES: objc_interop
// SR-9838 Disable because it blocks PR testing.
// FIXME: https://github.com/apple/swift/issues/52252
// Disable because it blocks PR testing.
// UNSUPPORTED: CPU=i386
import Foundation

View File

@@ -986,24 +986,24 @@ keyPath.test("key path literal closures") {
expectEqual(3, variadicFn("a", "b", "c"))
}
// SR-6096
// https://github.com/apple/swift/issues/48651
protocol Protocol6096 {}
struct Value6096<ValueType> {}
extension Protocol6096 {
protocol P_48651 {}
struct S_48651<ValueType> {}
extension P_48651 {
var asString: String? {
return self as? String
}
}
extension Value6096 where ValueType: Protocol6096 {
extension S_48651 where ValueType: P_48651 {
func doSomething() {
_ = \ValueType.asString?.endIndex
}
}
extension Int: Protocol6096 {}
extension Int: P_48651 {}
keyPath.test("optional chaining component that needs generic instantiation") {
Value6096<Int>().doSomething()
S_48651<Int>().doSomething()
}
// Nested generics.

View File

@@ -589,8 +589,9 @@ func verifyWeakUnownedReflection
verifyExistentialField(child: i.next()!, name: "unowned_unsafe_existential")
expectNil(i.next())
// The original bug report from SR-5289 crashed when the print() code
// attempted to reflect the contents of an unowned field.
// The original bug report from https://github.com/apple/swift/issues/47864
// crashed when the print() code attempted to reflect the contents of an
// unowned field.
// The tests above _should_ suffice to check this, but let's print everything
// anyway just to be sure.
for c in m.children {
@@ -599,9 +600,10 @@ func verifyWeakUnownedReflection
}
#if _runtime(_ObjC)
// Related: SR-5289 reported a crash when using Mirror to inspect Swift
// class objects containing unowned pointers to Obj-C class objects.
mirrors.test("Weak and Unowned Obj-C refs in class (SR-5289)") {
// Related: https://github.com/apple/swift/issues/47864 reported a crash when
// using 'Mirror' to inspect Swift class objects containing unowned pointers
// to Obj-C class objects.
mirrors.test("Weak and Unowned Obj-C refs in class") {
class SwiftClassWithWeakAndUnowned {
var strong_class: WeakUnownedObjCClass
var strong_existential: WeakUnownedTestsP1 & WeakUnownedTestsP2

View File

@@ -305,12 +305,14 @@ OptionalTests.test("Casting Optional") {
expectTrue(anyToAny(x, Optional<Optional<C>>.self)!! === x)
expectTrue(anyToAnyOrNil(ni, Int.self) == nil)
// Test for SR-459: Weakened optionals don't zero.
// https://github.com/apple/swift/issues/43076
// Weakened optionals don't zero
var t = LifetimeTracked(0)
_ = anyToAny(Optional(t), CustomDebugStringConvertible.self)
expectTrue(anyToAnyIs(Optional(t), CustomDebugStringConvertible.self))
// Test for SR-912: Runtime exception casting an Any nil to an Optional.
// https://github.com/apple/swift/issues/43524
// Runtime exception casting an 'Any' nil to an 'Optional'
let oi: Int? = nil
expectTrue(anyToAny(oi as Any, Optional<Int>.self) == nil)
expectTrue(anyToAnyIs(oi as Any, Optional<Int>.self))

View File

@@ -768,8 +768,9 @@ PrintTests.test("Printable_Float") {
// Second-worst case for shortness:
expectDescription("7.038531e-26", Float("7.038531e-26")!)
// Note: The above test computes the reference value from a
// string because `7.038531e-26 as Float` is broken:
// See https://bugs.swift.org/browse/SR-7124
// string because `7.038531e-26 as Float` is broken.
//
// See https://github.com/apple/swift/issues/49672.
// NaNs require special care in testing:
// NaN is printed with additional detail to debugDescription, but not description

View File

@@ -74,7 +74,7 @@ suite.test("_rawHashValue forwarding") {
// RawRepresentable types. Adding a custom hash(into:) implementation should
// always be enough to customize hashing.
//
// See https://bugs.swift.org/browse/SR-10734
// See https://github.com/apple/swift/issues/53126.
if #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) {
let r = CustomRawRepresentable(rawValue: 42)!

View File

@@ -673,7 +673,10 @@ Reflection.test("ObjectIdentifier/CustomDebugStringConvertible") {
class C: Q1 & Codable { }
Reflection.test("multiprotocolTypes") {
// [SR-8158]: Printing type(of: Codable & Protocol type ) EXC_BAD_ACCESS
// https://github.com/apple/swift/issues/50690
// EXC_BAD_ACCESS when calling 'type(of:)' on protocol composition with
// 'Codable'
//
// This use of String(reflecting:) exercises a previously incorrect cast in
// NonFixedExistentialMetatypeBox::Container::getNumWitnessTables.
let obj: Q1 & Codable = C()

View File

@@ -790,7 +790,7 @@ ObjCConformsToProtocolTestSuite.test("cast/metatype") {
expectTrue(SomeSubclass.self is SomeObjCProto.Type)
}
// SR-7357
// https://github.com/apple/swift/issues/49905
extension Optional where Wrapped == NSData {
private class Inner {

View File

@@ -78,7 +78,7 @@ SIMDCodableTests.test("roundTrip") {
/* Apparently these fail to round trip not only for i386 but also on older
macOS versions, so we'll disable them entirely for now.
#if !arch(i386)
// https://bugs.swift.org/browse/SR-9759
// https://github.com/apple/swift-corelibs-foundation/issues/3548
testRoundTrip(SIMD2<Float>.self)
testRoundTrip(SIMD3<Float>.self)
testRoundTrip(SIMD4<Float>.self)

View File

@@ -210,7 +210,8 @@ StrideTestSuite.test("FloatingPointStride/rounding error") {
// multiply-add operation `(1 as Float).addingProduct(0.9, 6)` gives the
// result `6.3999996`. This is nonetheless the desired behavior because
// avoiding error accumulation and intermediate rounding error wherever
// possible will produce better results more often than not (see SR-6377).
// possible will produce better results more often than not (see
// https://github.com/apple/swift/issues/48927).
//
// If checking of end bounds has been inadvertently modified such that we're
// computing the distance from the penultimate element to the end (in this

View File

@@ -364,8 +364,10 @@ StringTests.test("[String].joined() -> String") {
}
StringTests.test("UnicodeScalarView.Iterator.Lifetime") {
// Tests that String.UnicodeScalarView.Iterator is maintaining the lifetime of
// an underlying String buffer. https://bugs.swift.org/browse/SR-5401
// https://github.com/apple/swift/issues/47975
//
// Tests that 'String.UnicodeScalarView.Iterator' is maintaining the lifetime
// of an underlying 'String' buffer.
//
// WARNING: it is very easy to write this test so it produces false negatives
// (i.e. passes even when the code is broken). The array, for example, seems

View File

@@ -241,7 +241,7 @@ CStringTests.test("String.cString.with.Array.UInt8.input") {
}
// no need to test every case; that is covered in other tests
expectCrashLater(
// Workaround for https://bugs.swift.org/browse/SR-16103 (rdar://91365967)
// Workaround for https://github.com/apple/swift/issues/58362 (rdar://91365967)
// withMessage: "input of String.init(cString:) must be null-terminated"
)
_ = String(cString: [] as [UInt8])
@@ -265,7 +265,7 @@ CStringTests.test("String.cString.with.Array.CChar.input") {
}
// no need to test every case; that is covered in other tests
expectCrashLater(
// Workaround for https://bugs.swift.org/browse/SR-16103 (rdar://91365967)
// Workaround for https://github.com/apple/swift/issues/58362 (rdar://91365967)
// withMessage: "input of String.init(cString:) must be null-terminated"
)
_ = String(cString: [] as [CChar])
@@ -293,7 +293,7 @@ CStringTests.test("String.cString.with.inout.UInt8.conversion") {
expectTrue(str.isEmpty)
c = 100
expectCrashLater(
// Workaround for https://bugs.swift.org/browse/SR-16103 (rdar://91365967)
// Workaround for https://github.com/apple/swift/issues/58362 (rdar://91365967)
// withMessage: "input of String.init(cString:) must be null-terminated"
)
str = String(cString: &c)
@@ -307,7 +307,7 @@ CStringTests.test("String.cString.with.inout.CChar.conversion") {
expectTrue(str.isEmpty)
c = 100
expectCrashLater(
// Workaround for https://bugs.swift.org/browse/SR-16103 (rdar://91365967)
// Workaround for https://github.com/apple/swift/issues/58362 (rdar://91365967)
// withMessage: "input of String.init(cString:) must be null-terminated"
)
str = String(cString: &c)
@@ -332,7 +332,7 @@ CStringTests.test("String.validatingUTF8.with.Array.input") {
}
// no need to test every case; that is covered in other tests
expectCrashLater(
// Workaround for https://bugs.swift.org/browse/SR-16103 (rdar://91365967)
// Workaround for https://github.com/apple/swift/issues/58362 (rdar://91365967)
// withMessage: "input of String.init(validatingUTF8:) must be null-terminated"
)
_ = String(validatingUTF8: [])
@@ -363,7 +363,7 @@ CStringTests.test("String.validatingUTF8.with.inout.conversion") {
expectEqual(str?.isEmpty, true)
c = 100
expectCrashLater(
// Workaround for https://bugs.swift.org/browse/SR-16103 (rdar://91365967)
// Workaround for https://github.com/apple/swift/issues/58362 (rdar://91365967)
// withMessage: "input of String.init(validatingUTF8:) must be null-terminated"
)
str = String(validatingUTF8: &c)
@@ -389,7 +389,7 @@ CStringTests.test("String.decodeCString.with.Array.input") {
}
// no need to test every case; that is covered in other tests
expectCrashLater(
// Workaround for https://bugs.swift.org/browse/SR-16103 (rdar://91365967)
// Workaround for https://github.com/apple/swift/issues/58362 (rdar://91365967)
// withMessage: "input of decodeCString(_:as:repairingInvalidCodeUnits:) must be null-terminated"
)
_ = String.decodeCString([], as: Unicode.UTF8.self)
@@ -427,7 +427,7 @@ CStringTests.test("String.decodeCString.with.inout.conversion") {
expectEqual(result?.repairsMade, false)
c = 100
expectCrashLater(
// Workaround for https://bugs.swift.org/browse/SR-16103 (rdar://91365967)
// Workaround for https://github.com/apple/swift/issues/58362 (rdar://91365967)
// withMessage: "input of decodeCString(_:as:repairingInvalidCodeUnits:) must be null-terminated"
)
result = String.decodeCString(&c, as: Unicode.UTF8.self)
@@ -451,7 +451,7 @@ CStringTests.test("String.init.decodingCString.with.Array.input") {
}
// no need to test every case; that is covered in other tests
expectCrashLater(
// Workaround for https://bugs.swift.org/browse/SR-16103 (rdar://91365967)
// Workaround for https://github.com/apple/swift/issues/58362 (rdar://91365967)
// withMessage: "input of decodeCString(_:as:repairingInvalidCodeUnits:) must be null-terminated"
)
_ = String(decodingCString: [], as: Unicode.UTF8.self)
@@ -479,7 +479,7 @@ CStringTests.test("String.init.decodingCString.with.inout.conversion") {
expectEqual(str.isEmpty, true)
c = 100
expectCrashLater(
// Workaround for https://bugs.swift.org/browse/SR-16103 (rdar://91365967)
// Workaround for https://github.com/apple/swift/issues/58362 (rdar://91365967)
// withMessage: "input of String.init(decodingCString:as:) must be null-terminated"
)
str = String(decodingCString: &c, as: Unicode.UTF8.self)

View File

@@ -40,7 +40,7 @@ StringBridgeTests.test("Tagged NSString") {
expectCocoa(bigBs)
expectCocoa(bigQs)
#if false // TODO(SR-7594): re-enable
#if false // FIXME: Re-enable (https://github.com/apple/swift/issues/50136)
let littleAsNSString = ("aa" as NSString)
var littleAs = littleAsNSString as String

View File

@@ -40,7 +40,8 @@ StringCreateTests.test("String(decoding:as:)") {
validateDecodingAs(simpleString.rawValue)
}
// Corner-case: UBP with null pointer (https://bugs.swift.org/browse/SR-9869)
// https://github.com/apple/swift/issues/52275
// Corner-case: UBP with null pointer.
expectEqual(
"", String(decoding: UnsafeBufferPointer(_empty: ()), as: UTF8.self))
expectEqual(

View File

@@ -31,7 +31,7 @@ func switchOver<S1: StringProtocol, S2: StringProtocol>(
) -> Character {
let (first, second) = ("first", "second")
// TODO(SR-12457): Enable
// FIXME: Enable (https://github.com/apple/swift/issues/54896)
#if true
fatalError()
#else
@@ -65,7 +65,7 @@ StringSwitchTests.test("switch") {
expectEqual("B", switchOver(second))
expectEqual("X", switchOver(foo))
// TODO(SR-12457): Enable
// FIXME: Enable (https://github.com/apple/swift/issues/54896)
#if true
#else
expectEqual("A", switchOver(first, first))

View File

@@ -125,8 +125,8 @@ func unsafeRawBufferPointerConversions(
_ = UnsafeRawBufferPointer(start: orp, count: 1)
}
struct SR9800 {
// https://github.com/apple/swift/issues/52224
struct S_52224 {
func foo(_: UnsafePointer<CChar>) {}
func foo(_: UnsafePointer<UInt8>) {}

View File

@@ -3,10 +3,10 @@
import Swift
// FIXME: https://github.com/apple/swift/issues/57444
// Work around the inability for static-library based Swift runtime builds to
// directly link against Darwin.swiftmodule by using a benign dependency on
// StdlibUnittest.
// https://bugs.swift.org/browse/SR-15118
import StdlibUnittest
runAllTests()

View File

@@ -102,8 +102,9 @@ mirrors.test("struct/StructHasNativeWeakReference") {
print(extractedChild)
}
// SR-8878: Using Mirror to access a weak reference results in object
// being retained indefinitely
// https://github.com/apple/swift/issues/51384
// Using 'Mirror' to access a weak reference results in object being
// retained indefinitely
mirrors.test("class/NativeSwiftClassHasNativeWeakReferenceNoLeak") {
weak var verifier: AnyObject?
do {

View File

@@ -25,8 +25,8 @@ extension A: BidirectionalCollection where C: BidirectionalCollection {
func index(before i: C.Index) -> C.Index { return c.index(before: i) }
}
// SR-8022
func sr8022() {
// https://github.com/apple/swift/issues/50555
do {
var c = A(c: X())
_ = c.popLast()
_ = c.removeLast()
@@ -34,5 +34,3 @@ func sr8022() {
_ = c.dropLast(2)
_ = c.suffix(2)
}
sr8022()

View File

@@ -162,8 +162,9 @@ internal extension TGMath {
expectEqual((0.625, 2), Self._frexp(2.5))
expectEqual(1, Self._ilogb(2.5))
#if os(Linux) && arch(x86_64)
// FIXME: https://github.com/apple/swift/issues/49782
// double-precision remquo is broken in the glibc in 14.04. Disable this
// test for all Linux in the short-term to un-FAIL the build. SR-7234.
// test for all Linux in the short-term to un-FAIL the build.
if Self.significandBitCount != 52 {
expectEqual(-0.25, Self._remquo(16, 0.625).0)
expectEqual(2, Self._remquo(16, 0.625).1 & 7)