//===----------------------------------------------------------------------===// // // This source file is part of the Swift Collections open source project // // Copyright (c) 2025 Apple Inc. and the Swift project authors // Licensed under Apache License v2.0 with Runtime Library Exception // // See https://swift.org/LICENSE.txt for license information // //===----------------------------------------------------------------------===// import XCTest import Future @available(SwiftStdlib 6.2, *) final class ContiguousStorageTests: XCTestCase { @available(SwiftStdlib 6.2, *) func testBorrowArrayStorage() throws { let capacity = 10 var a: [Int] = [] a = Array(0.. var startIndex: Int { 0 } var endIndex: Int { span.count } func index(after i: Int) -> Int { i+2 } @lifetime(copy contiguous) init(_ contiguous: borrowing Span) { span = copy contiguous } subscript(_ p: Int) -> Int { span[p] } } @available(SwiftStdlib 6.2, *) @inline(never) @lifetime(borrow array) private func skip( along array: borrowing Array ) -> Skipper { Skipper(array.span) } @available(SwiftStdlib 6.2, *) func testSpanWrapper() { let capacity = 8 let a = Array(0..