-
Notifications
You must be signed in to change notification settings - Fork 0
Fix macOS build: resolve type ambiguity, gate platform tests, and handle test runner crashes #69
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
Changes from all commits
61dbba8
d722e72
f9ff83f
5f59ee3
75697b6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -8,8 +8,9 @@ import XCTest | |||||
| final class PlatformExamplesTests: XCTestCase { | ||||||
|
|
||||||
| // MARK: - iOS Examples Tests | ||||||
|
|
||||||
| #if canImport(UIKit) && !os(watchOS) | ||||||
| // These tests reference types defined in Examples/iOSExamples.swift which is not | ||||||
| // part of any SPM target. Enable by passing -DINCLUDE_EXAMPLE_TESTS to swiftc. | ||||||
| #if INCLUDE_EXAMPLE_TESTS | ||||||
|
|
||||||
| @available(iOS 10.0, *) | ||||||
| func testNotificationManagerCreation() async throws { | ||||||
|
|
@@ -93,8 +94,9 @@ final class PlatformExamplesTests: XCTestCase { | |||||
| #endif | ||||||
|
|
||||||
| // MARK: - macOS Examples Tests | ||||||
|
|
||||||
| #if os(macOS) | ||||||
| // These tests reference types defined in Examples/macOSExamples.swift which is not | ||||||
| // part of any SPM target. Enable by passing -DINCLUDE_EXAMPLE_TESTS to swiftc. | ||||||
| #if INCLUDE_EXAMPLE_TESTS | ||||||
|
||||||
| #if INCLUDE_EXAMPLE_TESTS | |
| #if INCLUDE_EXAMPLE_TESTS && os(macOS) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| // Disambiguate HL7v3Kit types from Foundation types with the same names (available on macOS/Apple platforms). | ||
| // On macOS, Foundation vends XMLElement (NSXMLElement) and XMLDocument (NSXMLDocument) which | ||
| // collide with HL7v3Kit's own types. These typealiases ensure unqualified names resolve to HL7v3Kit. | ||
| import HL7v3Kit | ||
|
|
||
| typealias XMLElement = HL7v3Kit.XMLElement | ||
| typealias XMLDocument = HL7v3Kit.XMLDocument |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#if INCLUDE_EXAMPLE_TESTSno longer includes the previous platform guard (canImport(UIKit) && !os(watchOS)), so enabling the flag on macOS/Linux will try to compile iOS-only example types (and potentially UIKit-reliant code) and fail. Combine the flag with the original platform condition so the iOS example tests only compile on supported platforms.Also, for SPM this flag is typically passed via
swift test -Xswiftc -DINCLUDE_EXAMPLE_TESTS(not directly “to swiftc”).