Skip to content

Commit c34cea5

Browse files
authored
Set availability for inverted character class test (#621)
This feature depends on running with a Swift 5.7 stdlib, and fails when that isn't available.
1 parent ed95066 commit c34cea5

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ let package = Package(
9393
name: "DocumentationTests",
9494
dependencies: ["_StringProcessing", "RegexBuilder"],
9595
swiftSettings: [
96-
.unsafeFlags(["-Xfrontend", "-disable-availability-checking"]),
96+
availabilityDefinition,
9797
.unsafeFlags(["-enable-bare-slash-regex"]),
9898
]),
9999

Tests/DocumentationTests/RegexBuilderTests.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,13 @@ import RegexBuilder
1919

2020
class RegexBuilderTests: XCTestCase {}
2121

22+
@available(SwiftStdlib 5.7, *)
2223
extension RegexBuilderTests {
2324
func testCharacterClass_inverted() throws {
25+
// `CharacterClass` depends on some standard library SPI that is only
26+
// available in >= macOS 13. The warning for the next line is spurious.
27+
guard #available(macOS 13, *) else { return }
28+
2429
let validCharacters = CharacterClass("a"..."z", .anyOf("-_"))
2530
let invalidCharacters = validCharacters.inverted
2631

Tests/DocumentationTests/RegexTests.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import _StringProcessing
1818

1919
class RegexTests: XCTestCase {}
2020

21+
@available(SwiftStdlib 5.7, *)
2122
extension RegexTests {
2223
func testRegex() throws {
2324
// 'keyAndValue' is created using a regex literal
@@ -91,6 +92,7 @@ extension RegexTests {
9192
}
9293
}
9394

95+
@available(SwiftStdlib 5.7, *)
9496
extension RegexTests {
9597
func testRegex_wholeMatchIn() throws {
9698
let digits = /[0-9]+/

0 commit comments

Comments
 (0)