Files
swift-mirror/test/stdlib/objc-array-slice.swift
Erik Eckstein f0641db51d tests: add a test for a fix of getting an ArraySlice of an CocoaArray
The problem was fixed in 375f289597.

rdar://74807247
2021-03-25 19:26:12 +01:00

23 lines
501 B
Swift

// RUN: %empty-directory(%t)
// RUN: %target-build-swift %s -o %t/a.out
// RUN: %target-codesign %t/a.out
// RUN: %target-run %t/a.out | %FileCheck %s
// REQUIRES: executable_test
// REQUIRES: objc_interop
import Foundation
let array = NSMutableArray()
for _ in 0..<1000 {
array.insert(NSObject(), at: 0)
}
// Check that this does not crash because of an over-release of the array content.
_ = (array as! [NSObject]).prefix(3)
_ = (array as! [NSObject]).prefix(3)
// CHECK: done
print("done")