Skip to content

Set availability for inverted character class test #621

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ let package = Package(
name: "DocumentationTests",
dependencies: ["_StringProcessing", "RegexBuilder"],
swiftSettings: [
.unsafeFlags(["-Xfrontend", "-disable-availability-checking"]),
availabilityDefinition,
.unsafeFlags(["-enable-bare-slash-regex"]),
]),

Expand Down
5 changes: 5 additions & 0 deletions Tests/DocumentationTests/RegexBuilderTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,13 @@ import RegexBuilder

class RegexBuilderTests: XCTestCase {}

@available(SwiftStdlib 5.7, *)
extension RegexBuilderTests {
func testCharacterClass_inverted() throws {
// `CharacterClass` depends on some standard library SPI that is only
// available in >= macOS 13. The warning for the next line is spurious.
guard #available(macOS 13, *) else { return }

let validCharacters = CharacterClass("a"..."z", .anyOf("-_"))
let invalidCharacters = validCharacters.inverted

Expand Down
2 changes: 2 additions & 0 deletions Tests/DocumentationTests/RegexTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import _StringProcessing

class RegexTests: XCTestCase {}

@available(SwiftStdlib 5.7, *)
extension RegexTests {
func testRegex() throws {
// 'keyAndValue' is created using a regex literal
Expand Down Expand Up @@ -91,6 +92,7 @@ extension RegexTests {
}
}

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