Skip to content

Commit ddfac10

Browse files
authored
Merge pull request #2099 from spevans/pr_darwin_compat_fixes2
2 parents babf51b + 44bda25 commit ddfac10

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

DarwinCompatibilityTests.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
B97E7856222AF995007596B0 /* TestPropertyListEncoder.swift in Sources */ = {isa = PBXBuildFile; fileRef = B97E7855222AF995007596B0 /* TestPropertyListEncoder.swift */; };
1919
B987C65E2093C8AF0026B50D /* TestImports.swift in Sources */ = {isa = PBXBuildFile; fileRef = B987C65D2093C8AF0026B50D /* TestImports.swift */; };
2020
B98E33E02136AC120044EBE9 /* TestFileWithZeros.txt in Resources */ = {isa = PBXBuildFile; fileRef = B98E33DF2136AC120044EBE9 /* TestFileWithZeros.txt */; };
21+
B9C1C63422607372002BBEA0 /* FixtureValues.swift in Sources */ = {isa = PBXBuildFile; fileRef = B9C1C63322607372002BBEA0 /* FixtureValues.swift */; };
2122
B9C89F361F6BF89C00087AF4 /* TestScanner.swift in Sources */ = {isa = PBXBuildFile; fileRef = B9C89EE61F6BF88F00087AF4 /* TestScanner.swift */; };
2223
B9C89F371F6BF89C00087AF4 /* TestNSValue.swift in Sources */ = {isa = PBXBuildFile; fileRef = B9C89EE71F6BF88F00087AF4 /* TestNSValue.swift */; };
2324
B9C89F381F6BF89C00087AF4 /* TestUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = B9C89EE81F6BF88F00087AF4 /* TestUtils.swift */; };
@@ -164,6 +165,7 @@
164165
B97E7855222AF995007596B0 /* TestPropertyListEncoder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = TestPropertyListEncoder.swift; path = TestFoundation/TestPropertyListEncoder.swift; sourceTree = "<group>"; };
165166
B987C65D2093C8AF0026B50D /* TestImports.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = TestImports.swift; path = TestFoundation/TestImports.swift; sourceTree = "<group>"; };
166167
B98E33DF2136AC120044EBE9 /* TestFileWithZeros.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = TestFileWithZeros.txt; path = TestFoundation/Resources/TestFileWithZeros.txt; sourceTree = "<group>"; };
168+
B9C1C63322607372002BBEA0 /* FixtureValues.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = FixtureValues.swift; path = TestFoundation/FixtureValues.swift; sourceTree = "<group>"; };
167169
B9C89ED11F6BF67C00087AF4 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Platforms/MacOSX.platform/Developer/Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; };
168170
B9C89ED71F6BF77E00087AF4 /* DarwinCompatibilityTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DarwinCompatibilityTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
169171
B9C89EDB1F6BF77E00087AF4 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
@@ -299,6 +301,7 @@
299301
B9C89EB81F6BF47D00087AF4 = {
300302
isa = PBXGroup;
301303
children = (
304+
B9C1C63322607372002BBEA0 /* FixtureValues.swift */,
302305
B940492A223B13D000FB4384 /* TestProgressFraction.swift */,
303306
B97E7855222AF995007596B0 /* TestPropertyListEncoder.swift */,
304307
B97E7853222AF973007596B0 /* TestDateIntervalFormatter.swift */,
@@ -566,6 +569,7 @@
566569
isa = PBXSourcesBuildPhase;
567570
buildActionMask = 2147483647;
568571
files = (
572+
B9C1C63422607372002BBEA0 /* FixtureValues.swift in Sources */,
569573
B940492B223B13D000FB4384 /* TestProgressFraction.swift in Sources */,
570574
B97E7856222AF995007596B0 /* TestPropertyListEncoder.swift in Sources */,
571575
B97E7854222AF973007596B0 /* TestDateIntervalFormatter.swift in Sources */,

TestFoundation/TestProcess.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -626,13 +626,19 @@ internal func runTask(_ arguments: [String], environment: [String: String]? = ni
626626
stderrPipe.fileHandleForReading.readabilityHandler = nil
627627

628628
// Drain any data remaining in the pipes
629+
#if DARWIN_COMPATIBILITY_TESTS
630+
// Use old API for now
631+
stdoutData.append(stdoutPipe.fileHandleForReading.availableData)
632+
stderrData.append(stderrPipe.fileHandleForReading.availableData)
633+
#else
629634
if let d = try stdoutPipe.fileHandleForReading.readToEnd() {
630635
stdoutData.append(d)
631636
}
632637

633638
if let d = try stderrPipe.fileHandleForReading.readToEnd() {
634639
stderrData.append(d)
635640
}
641+
#endif
636642

637643
guard process.terminationStatus == 0 else {
638644
throw Error.TerminationStatus(process.terminationStatus)

TestFoundation/TestStream.swift

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@
77
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
88
//
99

10-
#if canImport(SwiftFoundation) && !DEPLOYMENT_RUNTIME_OBJC
11-
@testable import SwiftFoundation
12-
#else
13-
@testable import Foundation
10+
#if NS_FOUNDATION_ALLOWS_TESTABLE_IMPORT
11+
#if canImport(SwiftFoundation) && !DEPLOYMENT_RUNTIME_OBJC
12+
@testable import SwiftFoundation
13+
#else
14+
@testable import Foundation
15+
#endif
1416
#endif
1517

1618

0 commit comments

Comments
 (0)