Work around SPM limitations around test case availability 💗

This commit is contained in:
Karoy Lorentey committed 2023-03-20 19:34:52 -07:00
1 parent b022b7fee5
commit 44cff40712
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()
+17
View File
@@ -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
}
+4 -1
View File
@@ -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)
+2
View File
@@ -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)
+4 -1
View File
@@ -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)