mirror of
https://github.com/apple/swift-collections
synced 2026-11-28 05:04:21 +00:00
Work around SPM limitations around test case availability 💗
This commit is contained in:
5 files changed
+39
-4
No files matched your search
@@ -17,12 +17,22 @@ open class CollectionTestCase: XCTestCase {
|
||||
|
||||
public var context: TestContext { _context! }
|
||||
|
||||
public override func setUp() {
|
||||
open var isAvailable: Bool { true }
|
||||
|
||||
public override func invokeTest() {
|
||||
guard isAvailable else {
|
||||
print("\(Self.self) unavailable; skipping")
|
||||
return
|
||||
}
|
||||
return super.invokeTest()
|
||||
}
|
||||
|
||||
open override func setUp() {
|
||||
super.setUp()
|
||||
_context = TestContext.pushNew()
|
||||
}
|
||||
|
||||
public override func tearDown() {
|
||||
open override func tearDown() {
|
||||
TestContext.pop(context)
|
||||
_context = nil
|
||||
super.tearDown()
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This source file is part of the Swift Collections open source project
|
||||
//
|
||||
// Copyright (c) 2023 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
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
var isRunningOnSwiftStdlib5_8: Bool {
|
||||
if #available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, *) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
@@ -10,11 +10,14 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if swift(>=5.8)
|
||||
import _CollectionsTestSupport
|
||||
import _RopeModule
|
||||
import XCTest
|
||||
|
||||
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, *)
|
||||
class TestBString: XCTestCase {
|
||||
class TestBString: CollectionTestCase {
|
||||
override var isAvailable: Bool { isRunningOnSwiftStdlib5_8 }
|
||||
|
||||
override class func setUp() {
|
||||
// Turn off output buffering.
|
||||
setbuf(stdout, nil)
|
||||
|
||||
@@ -16,6 +16,8 @@ import XCTest
|
||||
|
||||
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, *)
|
||||
class TestBString2: CollectionTestCase {
|
||||
override var isAvailable: Bool { isRunningOnSwiftStdlib5_8 }
|
||||
|
||||
func testUTF8View() {
|
||||
let str = _BString(shortSample)
|
||||
checkBidirectionalCollection(str.utf8, expectedContents: shortSample.utf8)
|
||||
|
||||
@@ -10,11 +10,14 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if swift(>=5.8)
|
||||
import _CollectionsTestSupport
|
||||
import _RopeModule
|
||||
import XCTest
|
||||
|
||||
@available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, *)
|
||||
class TestBigString: XCTestCase {
|
||||
class TestBigString: CollectionTestCase {
|
||||
override var isAvailable: Bool { isRunningOnSwiftStdlib5_8 }
|
||||
|
||||
override class func setUp() {
|
||||
// Turn off output buffering.
|
||||
setbuf(stdout, nil)
|
||||
|
||||
Reference in new issue
Block a user