Skip to content

Skip Swift Testing predicate tests on Xcode 14/15#6937

Merged
ajpallares merged 5 commits into
mainfrom
pallares/skip-swift-testing-older-xcode
Jun 8, 2026
Merged

Skip Swift Testing predicate tests on Xcode 14/15#6937
ajpallares merged 5 commits into
mainfrom
pallares/skip-swift-testing-older-xcode

Conversation

@ajpallares

@ajpallares ajpallares commented Jun 8, 2026

Copy link
Copy Markdown
Member

Motivation

The run-test-ios-16 (Xcode 15.4) and run-test-ios-15-and-14 (Xcode 14.3.1) CI jobs fail to compile the new RulesEngineInternal tests because Swift Testing's Testing module only ships with the Xcode 16+ toolchain.

Description

Gate the two Swift Testing files behind #if compiler(>=5.9) && canImport(Testing) so they compile only where the toolchain provides it; the remaining XCTest tests still run everywhere.

Notes

The outer #if compiler(>=5.9) is required in addition to canImport(Testing). With only canImport, Swift 5.8 (Xcode 14) still parses the inactive branch and rejects the #expect/#require macros as unknown directives. The version check makes the pre-macro compiler skip the body without parsing it.


Note

Low Risk
Test-only conditional compilation with no production or runtime behavior changes.

Overview
Wraps PredicateConformanceRunner.swift and PredicateFixtureTests.swift in #if compiler(>=5.9) and #if canImport(Testing)#endif so Swift Testing code (including #expect / #require) is only compiled on Xcode 16+ toolchains.

Older CI (Xcode 14/15) no longer fails on those files; XCTest tests in the same target are unchanged and still build and run everywhere.

Reviewed by Cursor Bugbot for commit f4380de. Bugbot is set up for automated code reviews on this repo. Configure here.

ajpallares and others added 2 commits June 8, 2026 15:57
Gate the RulesEngineInternal Swift Testing files behind
`#if canImport(Testing)` so they compile only on the Xcode 16+ toolchain.
The Xcode 14/15 CI jobs (run-test-ios-16, run-test-ios-15-and-14) lack the
Testing module and were failing to compile.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@ajpallares

Copy link
Copy Markdown
Member Author

@RCGitBot please test run-test-ios-15-and-14 run-test-ios-16

@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown

🚀 Triggered run-test-ios-15-and-14 run-test-ios-16Pipeline #38998

ajpallares and others added 2 commits June 8, 2026 16:13
`#if canImport(Testing)` alone is insufficient on Xcode 14 (Swift 5.8):
the pre-macro parser still reads `#expect`/`#require` in the inactive
branch and fails with "unknown directive". Wrapping in `#if compiler(>=5.9)`
makes Swift 5.8 skip the body without parsing it.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@ajpallares

Copy link
Copy Markdown
Member Author

@RCGitBot please test run-test-ios-15-and-14 run-test-ios-16

@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown

🚀 Triggered run-test-ios-15-and-14 run-test-ios-16Pipeline #39003

@ajpallares ajpallares marked this pull request as ready for review June 8, 2026 14:37
@ajpallares ajpallares requested a review from a team as a code owner June 8, 2026 14:37

@rickvdl rickvdl left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Great to be able to use Swift testing on these and more going forward :)

@ajpallares ajpallares merged commit f1af9d4 into main Jun 8, 2026
20 of 22 checks passed
@ajpallares ajpallares deleted the pallares/skip-swift-testing-older-xcode branch June 8, 2026 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants