@@ -340,7 +340,7 @@ class BundlePlayground {
340
340
class TestBundle : XCTestCase {
341
341
342
342
static var allTests : [ ( String , ( TestBundle ) -> ( ) throws -> Void ) ] {
343
- return [
343
+ var tests : [ ( String , ( TestBundle ) -> ( ) throws -> Void ) ] = [
344
344
( " test_paths " , test_paths) ,
345
345
( " test_resources " , test_resources) ,
346
346
( " test_infoPlist " , test_infoPlist) ,
@@ -353,10 +353,17 @@ class TestBundle : XCTestCase {
353
353
( " test_bundleFindExecutable " , test_bundleFindExecutable) ,
354
354
( " test_bundleFindAuxiliaryExecutables " , test_bundleFindAuxiliaryExecutables) ,
355
355
( " test_bundleReverseBundleLookup " , test_bundleReverseBundleLookup) ,
356
- ( " test_mainBundleExecutableURL " , test_mainBundleExecutableURL) ,
357
356
]
357
+
358
+ #if NS_FOUNDATION_ALLOWS_TESTABLE_IMPORT
359
+ tests. append ( contentsOf: [
360
+ ( " test_mainBundleExecutableURL " , test_mainBundleExecutableURL) ,
361
+ ] )
362
+ #endif
363
+
364
+ return tests
358
365
}
359
-
366
+
360
367
func test_paths( ) {
361
368
let bundle = testBundle ( )
362
369
@@ -560,13 +567,15 @@ class TestBundle : XCTestCase {
560
567
}
561
568
}
562
569
570
+ #if NS_FOUNDATION_ALLOWS_TESTABLE_IMPORT
563
571
func test_mainBundleExecutableURL( ) {
564
572
#if !DARWIN_COMPATIBILITY_TESTS // _CFProcessPath() is unavailable on native Foundation
565
573
let maybeURL = Bundle . main. executableURL
566
574
XCTAssertNotNil ( maybeURL)
567
575
guard let url = maybeURL else { return }
568
576
569
- XCTAssertEqual ( url. path, String ( cString : _CFProcessPath ( ) ) )
577
+ XCTAssertEqual ( url. path, ProcessInfo . processInfo . _processPath )
570
578
#endif
571
579
}
580
+ #endif
572
581
}
0 commit comments