Move three Foundation extensions into the cross-platform Swift package tests#25825
Merged
Conversation
The extension was a pure-Foundation leaf living in AztecExtensions, which is UIKit/Aztec-bound and can't build on macOS. Relocating it to WordPressShared lets URL+LinkNormalizationTests run under the root `swift test` cross-platform gate instead of the Xcode-only KeystoneTests bundle. AztecPostViewController already imports WordPressShared, so no caller changes are needed.
The extension was a pure-Foundation leaf in FormattableContentKit, which has UIKit-bound files (notification styling, image maps) and so can't build on macOS. Relocating it to WordPressShared lets ScannerTests run under the root `swift test` cross-platform gate. The method becomes public for the module boundary; its one internal caller (NSMutableAttributedString.applyAttributes(toQuotes:)) picks up an import WordPressShared.
The @objc extension lived in WordPressKit, which has UIKit-bound files and doesn't build on macOS. Relocating it to WordPressShared lets NSAttributedStringTests run under the root `swift test` cross-platform gate. FormattableContentKit carried a byte-identical internal copy of trimNewlines() on NSAttributedString; this deletes that duplicate and routes both it and the notification service extension's RichNotificationContentFormatter to the single WordPressShared definition.
Contributor
|
| App Name | WordPress | |
| Configuration | Release-Alpha | |
| Build Number | 33357 | |
| Version | PR #25825 | |
| Bundle ID | org.wordpress.alpha | |
| Commit | 614aa18 | |
| Installation URL | 7q02kkned9be0 |
Contributor
|
| App Name | Jetpack | |
| Configuration | Release-Alpha | |
| Build Number | 33357 | |
| Version | PR #25825 | |
| Bundle ID | com.jetpack.alpha | |
| Commit | 614aa18 | |
| Installation URL | 42tkc5dbtngn0 |
3 tasks
crazytonyli
approved these changes
Jul 22, 2026
jkmassel
added a commit
that referenced
this pull request
Jul 23, 2026
#25815 (KeystoneTests move) and #25825 (Foundation extensions) relocated 15 more XCTest suites into WordPressSharedTests after this branch was first written; convert them too so the swift test set stays entirely Swift Testing. NotificationCenterObserveOnceTests is pinned to @suite(.serialized) because its two tests share NotificationCenter.default and would race under Swift Testing's parallelism; QueueTests stays a final class because Queue is a value type it mutates.
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Continues #25815. Moves three Foundation-extension test suites — and the source they exercise — out of the Xcode-only
KeystoneTestsbundle intoWordPressShared, so they run underswift testat the repo root: the macOS cross-platform gate from #25344, which runs on a bare checkout with no Xcode project, no simulator, and no app build, in about 20 seconds.Each subject was already an
import Foundation-only leaf trapped inside a UIKit-bound module —AztecExtensions,FormattableContentKit, andWordPressKit— none of which build on macOS. Relocating the leaf intoWordPressShared(which all three already depend on) is cheaper than standing up a macOS test target for those heavier modules, and gets the test across the gate.Summary
URL.normalizedURLForWordPressLink()— out ofAztecExtensionsScanner.scanQuotedText()— out ofFormattableContentKit(madepublicfor the module boundary)NSAttributedString.trimNewlines()— out ofWordPressKit, plus a dedup (below)swift testgains 8 XCTest cases (URL 1, Scanner 5, NSAttributedString 2); the iOS suite keeps every one of these via the existingWordPressSharedTeststarget inWordPressUnitTests.xctestplan.The
trimNewlinesduplicateFormattableContentKitcarried a byte-identical internal copy oftrimNewlines()onNSAttributedString, alongside the@objc publicone inWordPressKit. Moving theWordPressKitcopy intoWordPressSharedlets this PR delete that duplicate and route both callers —FormattableContentFormatter(FCK) andRichNotificationContentFormatter(the notification service extension) — to the single definition.Caller changes
Minimal, because the destination module was already imported almost everywhere:
AztecPostViewControllerandFormattableContentFormatteralreadyimport WordPressShared→ unchanged.NSMutableAttributedString.applyAttributes(toQuotes:)(FCK) andRichNotificationContentFormatter(NSE) each pick up oneimport WordPressShared.WordPress/ClassesandTests/KeystoneTestsare file-system-synchronized groups, so none of this needs.pbxprojedits.Not in this PR
The fourth remaining Foundation-extension test,
NSMutableAttributedStringTests(applyStylesToMatchesWithPattern), needs more than a move — its subject shares an app file with aUIImage-based sibling, and the test itself builds styles out ofUIFont/UIColor, which don't exist on macOS. It's a separate follow-up (source split + test rewrite).Test plan
swift testfrom the repo root: the 3 moved suites run underWordPressSharedTests— URL 1, Scanner 5, NSAttributedString 2 — 0 failures.xcodebuild build-for-testing -scheme WordPress -testPlan WordPressUnitTests -destination 'generic/platform=iOS Simulator':** TEST BUILD SUCCEEDED **— the app, notification service extension,AztecExtensions,FormattableContentKit,WordPressKit,KeystoneTests, and everyModules/*test target still compile.swiftlint: 0 violations across the 8 changed Swift files.Related