1010
1111@testable @_spi ( ForToolsIntegrationOnly) import Testing
1212private import _TestingInternals
13- #if canImport(AppKit)
13+ #if canImport(AppKit) && canImport(_Testing_AppKit)
1414import AppKit
1515@_spi ( Experimental) import _Testing_AppKit
1616#endif
17- #if canImport(Foundation)
17+ #if canImport(Foundation) && canImport(_Testing_Foundation)
1818import Foundation
1919import _Testing_Foundation
2020#endif
21- #if canImport(CoreGraphics)
21+ #if canImport(CoreGraphics) && canImport(_Testing_CoreGraphics)
2222import CoreGraphics
2323@_spi ( Experimental) import _Testing_CoreGraphics
2424#endif
25- #if canImport(CoreImage)
25+ #if canImport(CoreImage) && canImport(_Testing_CoreImage)
2626import CoreImage
2727@_spi ( Experimental) import _Testing_CoreImage
2828#endif
29- #if canImport(UIKit)
29+ #if canImport(UIKit) && canImport(_Testing_UIKit)
3030import UIKit
3131@_spi ( Experimental) import _Testing_UIKit
3232#endif
@@ -259,7 +259,7 @@ struct AttachmentTests {
259259 }
260260 }
261261
262- #if canImport(Foundation)
262+ #if canImport(Foundation) && canImport(_Testing_Foundation)
263263#if !SWT_NO_FILE_IO
264264 @Test func attachContentsOfFileURL( ) async throws {
265265 let data = try #require( " <!doctype html> " . data ( using: . utf8) )
@@ -481,7 +481,7 @@ extension AttachmentTests {
481481 try test ( value)
482482 }
483483
484- #if canImport(Foundation)
484+ #if canImport(Foundation) && canImport(_Testing_Foundation)
485485 @Test func data( ) throws {
486486 let value = try #require( " abc123 " . data ( using: . utf8) )
487487 try test ( value)
@@ -499,7 +499,7 @@ extension AttachmentTests {
499499 case couldNotCreateCGImage
500500 }
501501
502- #if canImport(CoreGraphics)
502+ #if canImport(CoreGraphics) && canImport(_Testing_CoreGraphics)
503503 static let cgImage = Result < CGImage , any Error > {
504504 let size = CGSize ( width: 32.0 , height: 32.0 )
505505 let rgb = CGColorSpaceCreateDeviceRGB ( )
@@ -606,7 +606,7 @@ extension AttachmentTests {
606606 }
607607#endif
608608
609- #if canImport(CoreImage)
609+ #if canImport(CoreImage) && canImport(_Testing_CoreImage)
610610 @available ( _uttypesAPI, * )
611611 @Test func attachCIImage( ) throws {
612612 let image = CIImage ( cgImage: try Self . cgImage. get ( ) )
@@ -618,7 +618,7 @@ extension AttachmentTests {
618618 }
619619#endif
620620
621- #if canImport(AppKit)
621+ #if canImport(AppKit) && canImport(_Testing_AppKit)
622622 static var nsImage : NSImage {
623623 get throws {
624624 let cgImage = try cgImage. get ( )
@@ -683,7 +683,7 @@ extension AttachmentTests {
683683 }
684684#endif
685685
686- #if canImport(UIKit)
686+ #if canImport(UIKit) && canImport(_Testing_UIKit)
687687 @available ( _uttypesAPI, * )
688688 @Test func attachUIImage( ) throws {
689689 let image = UIImage ( cgImage: try Self . cgImage. get ( ) )
@@ -742,7 +742,7 @@ struct MySendableAttachableWithDefaultByteCount: Attachable, Sendable {
742742 }
743743}
744744
745- #if canImport(Foundation)
745+ #if canImport(Foundation) && canImport(_Testing_Foundation)
746746struct MyCodableAttachable : Codable , Attachable , Sendable {
747747 var string : String
748748}
@@ -784,7 +784,7 @@ final class MyCodableAndSecureCodingAttachable: NSObject, Codable, NSSecureCodin
784784}
785785#endif
786786
787- #if canImport(AppKit)
787+ #if canImport(AppKit) && canImport(_Testing_AppKit)
788788private final class MyImage : NSImage {
789789 override init ( size: NSSize ) {
790790 super. init ( size: size)
0 commit comments