10
10
11
11
@testable @_spi ( ForToolsIntegrationOnly) import Testing
12
12
private import _TestingInternals
13
- #if canImport(AppKit)
13
+ #if canImport(AppKit) && canImport(_Testing_AppKit)
14
14
import AppKit
15
15
@_spi ( Experimental) import _Testing_AppKit
16
16
#endif
17
- #if canImport(Foundation)
17
+ #if canImport(Foundation) && canImport(_Testing_Foundation)
18
18
import Foundation
19
19
import _Testing_Foundation
20
20
#endif
21
- #if canImport(CoreGraphics)
21
+ #if canImport(CoreGraphics) && canImport(_Testing_CoreGraphics)
22
22
import CoreGraphics
23
23
@_spi ( Experimental) import _Testing_CoreGraphics
24
24
#endif
25
- #if canImport(CoreImage)
25
+ #if canImport(CoreImage) && canImport(_Testing_CoreImage)
26
26
import CoreImage
27
27
@_spi ( Experimental) import _Testing_CoreImage
28
28
#endif
29
- #if canImport(UIKit)
29
+ #if canImport(UIKit) && canImport(_Testing_UIKit)
30
30
import UIKit
31
31
@_spi ( Experimental) import _Testing_UIKit
32
32
#endif
@@ -259,7 +259,7 @@ struct AttachmentTests {
259
259
}
260
260
}
261
261
262
- #if canImport(Foundation)
262
+ #if canImport(Foundation) && canImport(_Testing_Foundation)
263
263
#if !SWT_NO_FILE_IO
264
264
@Test func attachContentsOfFileURL( ) async throws {
265
265
let data = try #require( " <!doctype html> " . data ( using: . utf8) )
@@ -481,7 +481,7 @@ extension AttachmentTests {
481
481
try test ( value)
482
482
}
483
483
484
- #if canImport(Foundation)
484
+ #if canImport(Foundation) && canImport(_Testing_Foundation)
485
485
@Test func data( ) throws {
486
486
let value = try #require( " abc123 " . data ( using: . utf8) )
487
487
try test ( value)
@@ -499,7 +499,7 @@ extension AttachmentTests {
499
499
case couldNotCreateCGImage
500
500
}
501
501
502
- #if canImport(CoreGraphics)
502
+ #if canImport(CoreGraphics) && canImport(_Testing_CoreGraphics)
503
503
static let cgImage = Result < CGImage , any Error > {
504
504
let size = CGSize ( width: 32.0 , height: 32.0 )
505
505
let rgb = CGColorSpaceCreateDeviceRGB ( )
@@ -606,7 +606,7 @@ extension AttachmentTests {
606
606
}
607
607
#endif
608
608
609
- #if canImport(CoreImage)
609
+ #if canImport(CoreImage) && canImport(_Testing_CoreImage)
610
610
@available ( _uttypesAPI, * )
611
611
@Test func attachCIImage( ) throws {
612
612
let image = CIImage ( cgImage: try Self . cgImage. get ( ) )
@@ -618,7 +618,7 @@ extension AttachmentTests {
618
618
}
619
619
#endif
620
620
621
- #if canImport(AppKit)
621
+ #if canImport(AppKit) && canImport(_Testing_AppKit)
622
622
static var nsImage : NSImage {
623
623
get throws {
624
624
let cgImage = try cgImage. get ( )
@@ -683,7 +683,7 @@ extension AttachmentTests {
683
683
}
684
684
#endif
685
685
686
- #if canImport(UIKit)
686
+ #if canImport(UIKit) && canImport(_Testing_UIKit)
687
687
@available ( _uttypesAPI, * )
688
688
@Test func attachUIImage( ) throws {
689
689
let image = UIImage ( cgImage: try Self . cgImage. get ( ) )
@@ -742,7 +742,7 @@ struct MySendableAttachableWithDefaultByteCount: Attachable, Sendable {
742
742
}
743
743
}
744
744
745
- #if canImport(Foundation)
745
+ #if canImport(Foundation) && canImport(_Testing_Foundation)
746
746
struct MyCodableAttachable : Codable , Attachable , Sendable {
747
747
var string : String
748
748
}
@@ -784,7 +784,7 @@ final class MyCodableAndSecureCodingAttachable: NSObject, Codable, NSSecureCodin
784
784
}
785
785
#endif
786
786
787
- #if canImport(AppKit)
787
+ #if canImport(AppKit) && canImport(_Testing_AppKit)
788
788
private final class MyImage : NSImage {
789
789
override init ( size: NSSize ) {
790
790
super. init ( size: size)
0 commit comments