7
7
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
8
8
//
9
9
10
- #if !DEPLOYMENT_RUNTIME_OBJC && (os(Linux) || os(Android))
11
- @testable import Foundation
12
- #else
13
- @testable import SwiftFoundation
10
+ #if NS_FOUNDATION_ALLOWS_TESTABLE_IMPORT
11
+ #if (os(Linux) || os(Android))
12
+ @testable import Foundation
13
+ #else
14
+ @testable import SwiftFoundation
15
+ #endif
14
16
#endif
15
17
16
18
class TestFileManager : XCTestCase {
@@ -35,13 +37,18 @@ class TestFileManager : XCTestCase {
35
37
( " test_temporaryDirectoryForUser " , test_temporaryDirectoryForUser) ,
36
38
( " test_creatingDirectoryWithShortIntermediatePath " , test_creatingDirectoryWithShortIntermediatePath) ,
37
39
( " test_mountedVolumeURLs " , test_mountedVolumeURLs) ,
38
- ( " test_XDGStopgapsCoverAllConstants " , test_XDGStopgapsCoverAllConstants) ,
39
40
]
40
41
41
- #if !DEPLOYMENT_RUNTIME_OBJC
42
+ #if !DEPLOYMENT_RUNTIME_OBJC && NS_FOUNDATION_ALLOWS_TESTABLE_IMPORT
42
43
tests. append ( contentsOf: [
44
+ ( " test_xdgStopgapsCoverAllConstants " , test_xdgStopgapsCoverAllConstants) ,
43
45
( " test_parseXDGConfiguration " , test_parseXDGConfiguration) ,
44
46
( " test_xdgURLSelection " , test_xdgURLSelection) ,
47
+ ] )
48
+ #endif
49
+
50
+ #if !DEPLOYMENT_RUNTIME_OBJC
51
+ tests. append ( contentsOf: [
45
52
( " test_fetchXDGPathsFromHelper " , test_fetchXDGPathsFromHelper) ,
46
53
] )
47
54
#endif
@@ -965,7 +972,9 @@ class TestFileManager : XCTestCase {
965
972
}
966
973
967
974
#if !DEPLOYMENT_RUNTIME_OBJC // XDG tests require swift-corelibs-foundation
968
- func test_XDGStopgapsCoverAllConstants( ) {
975
+
976
+ #if NS_FOUNDATION_ALLOWS_TESTABLE_IMPORT // These are white box tests for the internals of XDG parsing:
977
+ func test_xdgStopgapsCoverAllConstants( ) {
969
978
let stopgaps = _XDGUserDirectory. stopgapDefaultDirectoryURLs
970
979
for directory in _XDGUserDirectory. allDirectories {
971
980
XCTAssertNotNil ( stopgaps [ directory] )
@@ -1076,6 +1085,9 @@ VIDEOS=StopgapVideos
1076
1085
assertSameAbsolutePath ( _XDGUserDirectory. publicShare. url ( userConfiguration: configuration, osDefaultConfiguration: osDefaults, stopgaps: stopgaps) , home. appendingPathComponent ( " SystemPublicShare " ) )
1077
1086
assertSameAbsolutePath ( _XDGUserDirectory. music. url ( userConfiguration: configuration, osDefaultConfiguration: osDefaults, stopgaps: stopgaps) , home. appendingPathComponent ( " StopgapMusic " ) )
1078
1087
}
1088
+ #endif // NS_FOUNDATION_ALLOWS_TESTABLE_IMPORT
1089
+
1090
+ // This test below is a black box test, and does not require @testable import.
1079
1091
1080
1092
enum TestError : Error {
1081
1093
case notImplementedOnThisPlatform
0 commit comments