Skip to content

[test] ArrayBridge: Add missing availability checks #39327

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 16, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion test/stdlib/ArrayBridge.swift.gyb
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,10 @@ tests.test("rdar://problem/27905230") {
}

tests.test("verbatimBridged/Base/withUnsafeBufferPointer") {
// https://bugs.swift.org/browse/SR-14663
// This tests a bad precondition that was fixed in
// https://github.com/apple/swift/pull/37960
guard #available(macOS 12, iOS 15, watchOS 8, tvOS 15, *) else { return }
let a = NSArray(array: [Base(0), Base(1), Base(2), Base(3)])
let b = a as! [Base]
let success: Bool = b.withUnsafeBufferPointer { buffer in
Expand All @@ -499,8 +503,11 @@ tests.test("verbatimBridged/Base/withUnsafeBufferPointer") {
expectTrue(success)
}

// https://bugs.swift.org/browse/SR-14663
tests.test("verbatimBridged/AnyObject/withUnsafeBufferPointer") {
// https://bugs.swift.org/browse/SR-14663
// This tests a bad precondition that was fixed in
// https://github.com/apple/swift/pull/37960
guard #available(macOS 12, iOS 15, watchOS 8, tvOS 15, *) else { return }
let a = NSArray(array: [Base(0), Base(1), Base(2), Base(3)])
let b = a as [AnyObject]
let success: Bool = b.withUnsafeBufferPointer { buffer in
Expand Down