diff --git a/CoreFoundation/Base.subproj/CFInternal.h b/CoreFoundation/Base.subproj/CFInternal.h index ccc58ee68f..a504aff3ca 100644 --- a/CoreFoundation/Base.subproj/CFInternal.h +++ b/CoreFoundation/Base.subproj/CFInternal.h @@ -216,7 +216,7 @@ extern void __CFGenericValidateType_(CFTypeRef cf, CFTypeID type, const char *fu #define __CFBitfield64GetValue(V, N1, N2) (((V) & __CFBitfield64Mask(N1, N2)) >> (N2)) #define __CFBitfield64SetValue(V, N1, N2, X) ((V) = ((V) & ~__CFBitfield64Mask(N1, N2)) | ((((uint64_t)X) << (N2)) & __CFBitfield64Mask(N1, N2))) -#if __LP64__ +#if __LP64__ || DEPLOYMENT_TARGET_ANDROID typedef uint64_t __CFInfoType; #define __CFInfoMask(N1, N2) __CFBitfield64Mask(N1, N2) #else diff --git a/CoreFoundation/Base.subproj/CFKnownLocations.c b/CoreFoundation/Base.subproj/CFKnownLocations.c index 2da610b213..e998e80803 100644 --- a/CoreFoundation/Base.subproj/CFKnownLocations.c +++ b/CoreFoundation/Base.subproj/CFKnownLocations.c @@ -45,7 +45,7 @@ CFURLRef _Nullable _CFKnownLocationCreatePreferencesURLForUser(CFKnownLocationUs } } -#elif !DEPLOYMENT_RUNTIME_OBJC && !DEPLOYMENT_TARGET_WINDOWS +#elif !DEPLOYMENT_RUNTIME_OBJC && !DEPLOYMENT_TARGET_WINDOWS && !DEPLOYMENT_TARGET_ANDROID /* Building for an OS that uses the FHS, BSD's hier(7), and/or the XDG specification for paths: diff --git a/CoreFoundation/Base.subproj/CFPlatform.c b/CoreFoundation/Base.subproj/CFPlatform.c index 52363ea6c2..97b7d1222e 100644 --- a/CoreFoundation/Base.subproj/CFPlatform.c +++ b/CoreFoundation/Base.subproj/CFPlatform.c @@ -297,6 +297,9 @@ CF_EXPORT CFStringRef CFCopyFullUserName(void) { uid_t euid; __CFGetUGIDs(&euid, NULL); struct passwd *upwd = getpwuid(euid ? euid : getuid()); +#if DEPLOYMENT_TARGET_ANDROID +#define pw_gecos pw_name +#endif if (upwd && upwd->pw_gecos) { result = CFStringCreateWithCString(kCFAllocatorSystemDefault, upwd->pw_gecos, kCFPlatformInterfaceStringEncoding); } diff --git a/CoreFoundation/Base.subproj/CFUtilities.c b/CoreFoundation/Base.subproj/CFUtilities.c index 03f7b8c3b1..c7f90cc65d 100644 --- a/CoreFoundation/Base.subproj/CFUtilities.c +++ b/CoreFoundation/Base.subproj/CFUtilities.c @@ -1000,6 +1000,7 @@ void CFLog1(CFLogLevel lev, CFStringRef message) { CFStringGetCString(message, buffer, maxLength, encoding); __android_log_print(priority, tag, "%s", buffer); + fprintf(stderr, "%s\n", buffer); if (buffer != &stack_buffer[0]) free(buffer); #else diff --git a/CoreFoundation/Base.subproj/ForSwiftFoundationOnly.h b/CoreFoundation/Base.subproj/ForSwiftFoundationOnly.h index 494c3dd45b..cfd376ab9c 100644 --- a/CoreFoundation/Base.subproj/ForSwiftFoundationOnly.h +++ b/CoreFoundation/Base.subproj/ForSwiftFoundationOnly.h @@ -403,6 +403,8 @@ static inline _Bool _withStackOrHeapBuffer(size_t amount, void (__attribute__((n static inline int _direntNameLength(struct dirent *entry) { #ifdef _D_EXACT_NAMLEN // defined on Linux return _D_EXACT_NAMLEN(entry); +#elif DEPLOYMENT_TARGET_ANDROID + return strlen(entry->d_name); #else return entry->d_namlen; #endif diff --git a/CoreFoundation/NumberDate.subproj/CFTimeZone.c b/CoreFoundation/NumberDate.subproj/CFTimeZone.c index 34ce79dc82..541af2c303 100644 --- a/CoreFoundation/NumberDate.subproj/CFTimeZone.c +++ b/CoreFoundation/NumberDate.subproj/CFTimeZone.c @@ -813,6 +813,15 @@ static CFTimeZoneRef __CFTimeZoneCreateSystem(void) { CFRelease(name); if (result) return result; } +#if DEPLOYMENT_TARGET_ANDROID + // Timezone database by name not available on Android. + // Approximate with gmtoff - could be general default. + struct tm info; + time_t now = time(NULL); + if (NULL != localtime_r(&now, &info)) { + return CFTimeZoneCreateWithTimeIntervalFromGMT(kCFAllocatorSystemDefault, info.tm_gmtoff); + } +#endif return CFTimeZoneCreateWithTimeIntervalFromGMT(kCFAllocatorSystemDefault, 0.0); } diff --git a/CoreFoundation/PlugIn.subproj/CFBundle.c b/CoreFoundation/PlugIn.subproj/CFBundle.c index 2b4f24291b..c6b9d16b1d 100644 --- a/CoreFoundation/PlugIn.subproj/CFBundle.c +++ b/CoreFoundation/PlugIn.subproj/CFBundle.c @@ -137,7 +137,7 @@ static void _CFBundleEnsureBundlesExistForImagePaths(CFArrayRef imagePaths); #pragma mark - -#if !DEPLOYMENT_RUNTIME_OBJC && !DEPLOYMENT_TARGET_WINDOWS +#if !DEPLOYMENT_RUNTIME_OBJC && !DEPLOYMENT_TARGET_WINDOWS && !DEPLOYMENT_TARGET_ANDROID // Functions and constants for FHS bundles: #define _CFBundleFHSDirectory_share CFSTR("share") @@ -162,10 +162,10 @@ static Boolean _CFBundleURLIsForFHSInstalledBundle(CFURLRef bundleURL) { return isFHSBundle; } -#endif // !DEPLOYMENT_RUNTIME_OBJC && !DEPLOYMENT_TARGET_WINDOWS +#endif // !DEPLOYMENT_RUNTIME_OBJC && !DEPLOYMENT_TARGET_WINDOWS && !DEPLOYMENT_TARGET_ANDROID Boolean _CFBundleSupportsFHSBundles() { -#if !DEPLOYMENT_RUNTIME_OBJC && !DEPLOYMENT_TARGET_WINDOWS +#if !DEPLOYMENT_RUNTIME_OBJC && !DEPLOYMENT_TARGET_WINDOWS && !DEPLOYMENT_TARGET_ANDROID return true; #else return false; @@ -714,7 +714,7 @@ static CFBundleRef _CFBundleCreate(CFAllocatorRef allocator, CFURLRef bundleURL, bundle->_url = newURL; -#if !DEPLOYMENT_RUNTIME_OBJC && !DEPLOYMENT_TARGET_WINDOWS +#if !DEPLOYMENT_RUNTIME_OBJC && !DEPLOYMENT_TARGET_WINDOWS && !DEPLOYMENT_TARGET_ANDROID bundle->_isFHSInstalledBundle = _CFBundleURLIsForFHSInstalledBundle(newURL); #endif diff --git a/CoreFoundation/PlugIn.subproj/CFBundle_Executable.c b/CoreFoundation/PlugIn.subproj/CFBundle_Executable.c index 568a6e495c..7e3b39d186 100644 --- a/CoreFoundation/PlugIn.subproj/CFBundle_Executable.c +++ b/CoreFoundation/PlugIn.subproj/CFBundle_Executable.c @@ -15,7 +15,7 @@ #include #endif -#if !DEPLOYMENT_RUNTIME_OBJC && !DEPLOYMENT_TARGET_WINDOWS +#if !DEPLOYMENT_RUNTIME_OBJC && !DEPLOYMENT_TARGET_WINDOWS && !DEPLOYMENT_TARGET_ANDROID #if DEPLOYMENT_TARGET_LINUX #if __LP64__ @@ -48,7 +48,7 @@ _kCFBundleFHSDirectory_lib #endif // DEPLOYMENT_TARGET_LINUX -#endif // !DEPLOYMENT_RUNTIME_OBJC && !DEPLOYMENT_TARGET_WINDOWS +#endif // !DEPLOYMENT_RUNTIME_OBJC && !DEPLOYMENT_TARGET_WINDOWS && !DEPLOYMENT_TARGET_ANDROID // This is here because on iPhoneOS with the dyld shared cache, we remove binaries from their // original locations on disk, so checking whether a binary's path exists is no longer sufficient. @@ -73,7 +73,7 @@ static CFURLRef _CFBundleCopyExecutableURLRaw(CFURLRef urlPath, CFStringRef exeN CFURLRef executableURL = NULL; if (!urlPath || !exeName) return NULL; -#if !DEPLOYMENT_RUNTIME_OBJC && !DEPLOYMENT_TARGET_WINDOWS +#if !DEPLOYMENT_RUNTIME_OBJC && !DEPLOYMENT_TARGET_WINDOWS && !DEPLOYMENT_TARGET_ANDROID if (!executableURL) { executableURL = CFURLCreateWithFileSystemPathRelativeToBase(kCFAllocatorSystemDefault, exeName, kCFURLPOSIXPathStyle, false, urlPath); if (!_binaryLoadable(executableURL)) { @@ -203,7 +203,7 @@ static CFURLRef _CFBundleCopyExecutableURLInDirectory2(CFBundleRef bundle, CFURL Boolean doExecSearch = true; #endif -#if !DEPLOYMENT_RUNTIME_OBJC && !DEPLOYMENT_TARGET_WINDOWS +#if !DEPLOYMENT_RUNTIME_OBJC && !DEPLOYMENT_TARGET_WINDOWS && !DEPLOYMENT_TARGET_ANDROID if (lookupMainExe && bundle && bundle->_isFHSInstalledBundle) { // For a FHS installed bundle, the URL points to share/Bundle.resources, and the binary is in: @@ -227,13 +227,13 @@ static CFURLRef _CFBundleCopyExecutableURLInDirectory2(CFBundleRef bundle, CFURL CFRelease(prefixPath); } -#endif // !DEPLOYMENT_RUNTIME_OBJC && !DEPLOYMENT_TARGET_WINDOWS +#endif // !DEPLOYMENT_RUNTIME_OBJC && !DEPLOYMENT_TARGET_WINDOWS && !DEPLOYMENT_TARGET_ANDROID // Now, look for the executable inside the bundle. if (!foundIt && doExecSearch && 0 != version) { CFURLRef exeDirURL = NULL; -#if !DEPLOYMENT_RUNTIME_OBJC && !DEPLOYMENT_TARGET_WINDOWS +#if !DEPLOYMENT_RUNTIME_OBJC && !DEPLOYMENT_TARGET_WINDOWS && !DEPLOYMENT_TARGET_ANDROID if (bundle && bundle->_isFHSInstalledBundle) { CFURLRef withoutExtension = CFURLCreateCopyDeletingPathExtension(kCFAllocatorSystemDefault, url); CFStringRef lastPathComponent = CFURLCopyLastPathComponent(withoutExtension); @@ -248,7 +248,7 @@ static CFURLRef _CFBundleCopyExecutableURLInDirectory2(CFBundleRef bundle, CFURL CFRelease(libexec); CFRelease(exeDirName); } else -#endif // !DEPLOYMENT_RUNTIME_OBJC && !DEPLOYMENT_TARGET_WINDOWS +#endif // !DEPLOYMENT_RUNTIME_OBJC && !DEPLOYMENT_TARGET_WINDOWS && !DEPLOYMENT_TARGET_ANDROID if (1 == version) { exeDirURL = CFURLCreateWithString(kCFAllocatorSystemDefault, _CFBundleExecutablesURLFromBase1, url); } else if (2 == version) { diff --git a/CoreFoundation/PlugIn.subproj/CFBundle_Internal.h b/CoreFoundation/PlugIn.subproj/CFBundle_Internal.h index 45f49c57c4..b94a9aeb18 100644 --- a/CoreFoundation/PlugIn.subproj/CFBundle_Internal.h +++ b/CoreFoundation/PlugIn.subproj/CFBundle_Internal.h @@ -31,7 +31,7 @@ CF_EXTERN_C_BEGIN #endif // FHS bundles are supported on the Swift and C runtimes, except on Windows. -#if !DEPLOYMENT_RUNTIME_OBJC && !DEPLOYMENT_TARGET_WINDOWS +#if !DEPLOYMENT_RUNTIME_OBJC && !DEPLOYMENT_TARGET_WINDOWS && !DEPLOYMENT_TARGET_ANDROID #if DEPLOYMENT_TARGET_LINUX || DEPLOYMENT_TARGET_FREEBSD #define _CFBundleFHSSharedLibraryFilenamePrefix CFSTR("lib") @@ -43,7 +43,7 @@ CF_EXTERN_C_BEGIN #error Disable FHS bundles or specify shared library prefixes and suffixes for this platform. #endif // DEPLOYMENT_TARGET_… -#endif // !DEPLOYMENT_RUNTIME_OBJC && !DEPLOYMENT_TARGET_WINDOWS +#endif // !DEPLOYMENT_RUNTIME_OBJC && !DEPLOYMENT_TARGET_WINDOWS && !DEPLOYMENT_TARGET_ANDROID #define CFBundleExecutableNotFoundError 4 #define CFBundleExecutableNotLoadableError 3584 diff --git a/CoreFoundation/URL.subproj/CFURL.c b/CoreFoundation/URL.subproj/CFURL.c index 0696b3ea46..3e25b4f756 100644 --- a/CoreFoundation/URL.subproj/CFURL.c +++ b/CoreFoundation/URL.subproj/CFURL.c @@ -25,10 +25,10 @@ #include #include #include -#if __has_include() -#include -#elif __has_include() +#if __has_include() #include +#else +#include #endif #include #endif diff --git a/Foundation.xcodeproj/project.pbxproj b/Foundation.xcodeproj/project.pbxproj index 0eeae8889a..46817e8365 100644 --- a/Foundation.xcodeproj/project.pbxproj +++ b/Foundation.xcodeproj/project.pbxproj @@ -344,6 +344,7 @@ B9974B9A1EDF4A22007F15B8 /* HTTPMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = B9974B931EDF4A22007F15B8 /* HTTPMessage.swift */; }; B9974B9B1EDF4A22007F15B8 /* BodySource.swift in Sources */ = {isa = PBXBuildFile; fileRef = B9974B941EDF4A22007F15B8 /* BodySource.swift */; }; B9974B9C1EDF4A22007F15B8 /* EasyHandle.swift in Sources */ = {isa = PBXBuildFile; fileRef = B9974B951EDF4A22007F15B8 /* EasyHandle.swift */; }; + BB3D7558208A1E500085CFDC /* TestImports.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB3D7557208A1E500085CFDC /* TestImports.swift */; }; BD8042161E09857800487EB8 /* TestLengthFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD8042151E09857800487EB8 /* TestLengthFormatter.swift */; }; BDBB65901E256BFA001A7286 /* TestEnergyFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = BDBB658F1E256BFA001A7286 /* TestEnergyFormatter.swift */; }; BDFDF0A71DFF5B3E00C04CC5 /* TestPersonNameComponents.swift in Sources */ = {isa = PBXBuildFile; fileRef = BDFDF0A61DFF5B3E00C04CC5 /* TestPersonNameComponents.swift */; }; @@ -825,6 +826,7 @@ B9974B931EDF4A22007F15B8 /* HTTPMessage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = HTTPMessage.swift; path = http/HTTPMessage.swift; sourceTree = ""; }; B9974B941EDF4A22007F15B8 /* BodySource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BodySource.swift; sourceTree = ""; }; B9974B951EDF4A22007F15B8 /* EasyHandle.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EasyHandle.swift; sourceTree = ""; }; + BB3D7557208A1E500085CFDC /* TestImports.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestImports.swift; sourceTree = ""; }; BD8042151E09857800487EB8 /* TestLengthFormatter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestLengthFormatter.swift; sourceTree = ""; }; BDBB658F1E256BFA001A7286 /* TestEnergyFormatter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestEnergyFormatter.swift; sourceTree = ""; }; BDFDF0A61DFF5B3E00C04CC5 /* TestPersonNameComponents.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestPersonNameComponents.swift; sourceTree = ""; }; @@ -1431,6 +1433,7 @@ children = ( 1520469A1D8AEABE00D02E36 /* HTTPServer.swift */, EA66F6381BF1619600136161 /* main.swift */, + BB3D7557208A1E500085CFDC /* TestImports.swift */, 9F4ADBCF1ECD4F56001F0B3D /* xdgTestHelper */, EA66F65A1BF1976100136161 /* Tests */, EA66F6391BF1619600136161 /* Resources */, @@ -2442,6 +2445,7 @@ 90E645DF1E4C89A400D0D47C /* TestNSCache.swift in Sources */, 5B13B34A1C582D4C00651CE2 /* TestURL.swift in Sources */, EA54A6FB1DB16D53009E0809 /* TestObjCRuntime.swift in Sources */, + BB3D7558208A1E500085CFDC /* TestImports.swift in Sources */, 5B13B34D1C582D4C00651CE2 /* TestNSUUID.swift in Sources */, 5B13B3281C582D4C00651CE2 /* TestBundle.swift in Sources */, 5B13B32A1C582D4C00651CE2 /* TestCharacterSet.swift in Sources */, diff --git a/Foundation/Bundle.swift b/Foundation/Bundle.swift index 921126ad40..38b395e9cb 100644 --- a/Foundation/Bundle.swift +++ b/Foundation/Bundle.swift @@ -53,8 +53,10 @@ open class Bundle: NSObject { self.init(path: url.path) } - public init(for aClass: AnyClass) { NSUnimplemented() } - + public init(for aClass: AnyClass) { + NSUnimplemented() + } + public init?(identifier: String) { super.init() diff --git a/Foundation/FileManager.swift b/Foundation/FileManager.swift index b69c77a831..99b5a93189 100644 --- a/Foundation/FileManager.swift +++ b/Foundation/FileManager.swift @@ -375,10 +375,13 @@ open class FileManager : NSObject { This method replaces fileSystemAttributesAtPath:. */ + #if os(Android) + @available(*, unavailable, message: "Unsuppported on this platform") + open func attributesOfFileSystem(forPath path: String) throws -> [FileAttributeKey : Any] { + NSUnsupported() + } + #else open func attributesOfFileSystem(forPath path: String) throws -> [FileAttributeKey : Any] { -#if os(Android) - NSUnimplemented() -#else // statvfs(2) doesn't support 64bit inode on Darwin (apfs), fallback to statfs(2) #if os(macOS) || os(iOS) var s = statfs() @@ -407,8 +410,8 @@ open class FileManager : NSObject { result[.systemFreeNodes] = NSNumber(value: UInt64(s.f_ffree)) return result -#endif } +#endif /* createSymbolicLinkAtPath:withDestination:error: returns YES if the symbolic link that point at 'destPath' was able to be created at the location specified by 'path'. If this method returns NO, the link was unable to be created and an NSError will be returned by reference in the 'error' parameter. This method does not traverse a terminal symlink. diff --git a/Foundation/NSCFString.swift b/Foundation/NSCFString.swift index 638de7e449..a4fd04b4f4 100644 --- a/Foundation/NSCFString.swift +++ b/Foundation/NSCFString.swift @@ -71,8 +71,8 @@ internal final class _NSCFConstantString : _NSCFString { // FIXME: Split expression as a work-around for slow type // checking (tracked by SR-5322). let offTemp1 = MemoryLayout.size + MemoryLayout.size - let offTemp2 = MemoryLayout<_CFInfo>.size - return offTemp1 + offTemp2 + MemoryLayout>.size + let offset = offTemp1 + MemoryLayout<_CFInfo>.size + return offset + MemoryLayout>.size } private var _lenPtr : UnsafeMutableRawPointer { diff --git a/Foundation/NSTimeZone.swift b/Foundation/NSTimeZone.swift index 5e5b311017..61eedeb8c5 100644 --- a/Foundation/NSTimeZone.swift +++ b/Foundation/NSTimeZone.swift @@ -179,14 +179,6 @@ open class NSTimeZone : NSObject, NSCopying, NSSecureCoding, NSCoding { extension NSTimeZone { open class var system: TimeZone { -#if os(Android) - var now = time(nil), info = tm() - if localtime_r(&now, &info) != nil { - // NOTE: this is not a real time zone but a fixed offset from GMT. - // It will be incorrect outside the current daylight saving period. - return TimeZone(reference: NSTimeZone(forSecondsFromGMT: info.tm_gmtoff)) - } -#endif return CFTimeZoneCopySystem()._swiftObject } diff --git a/TestFoundation/HTTPServer.swift b/TestFoundation/HTTPServer.swift index 656dbd3808..00a22304c9 100644 --- a/TestFoundation/HTTPServer.swift +++ b/TestFoundation/HTTPServer.swift @@ -14,17 +14,9 @@ import Dispatch -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) - import Foundation - import XCTest -#else - import SwiftFoundation - import SwiftXCTest -#endif - -#if os(macOS) || os(iOS) +#if canImport(Darwin) import Darwin -#elseif os(Linux) +#elseif canImport(Glibc) import Glibc #endif diff --git a/TestFoundation/TestAffineTransform.swift b/TestFoundation/TestAffineTransform.swift index 86da70fe4e..abc4c8518e 100644 --- a/TestFoundation/TestAffineTransform.swift +++ b/TestFoundation/TestAffineTransform.swift @@ -7,17 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // - - -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) - import Foundation - import XCTest -#else - import SwiftFoundation - import SwiftXCTest -#endif - - class TestAffineTransform : XCTestCase { private let accuracyThreshold = 0.001 diff --git a/TestFoundation/TestBundle.swift b/TestFoundation/TestBundle.swift index 68690ff32e..e0a4844689 100644 --- a/TestFoundation/TestBundle.swift +++ b/TestFoundation/TestBundle.swift @@ -7,15 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // - -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) -import Foundation -import XCTest -#else -import SwiftFoundation -import SwiftXCTest -#endif - import CoreFoundation internal func testBundle() -> Bundle { diff --git a/TestFoundation/TestByteCountFormatter.swift b/TestFoundation/TestByteCountFormatter.swift index c07726689c..97161b2fcd 100644 --- a/TestFoundation/TestByteCountFormatter.swift +++ b/TestFoundation/TestByteCountFormatter.swift @@ -7,18 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // - - -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) - import Foundation - import XCTest -#else - import SwiftFoundation - import SwiftXCTest -#endif - - - class TestByteCountFormatter : XCTestCase { static var allTests: [(String, (TestByteCountFormatter) -> () throws -> Void)] { diff --git a/TestFoundation/TestCalendar.swift b/TestFoundation/TestCalendar.swift index 4101b8ba75..aed09454c1 100644 --- a/TestFoundation/TestCalendar.swift +++ b/TestFoundation/TestCalendar.swift @@ -7,14 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) -import Foundation -import XCTest -#else -import SwiftFoundation -import SwiftXCTest -#endif - class TestCalendar: XCTestCase { static var allTests: [(String, (TestCalendar) -> () throws -> Void)] { diff --git a/TestFoundation/TestCharacterSet.swift b/TestFoundation/TestCharacterSet.swift index 157a306648..7b2b00a7f2 100644 --- a/TestFoundation/TestCharacterSet.swift +++ b/TestFoundation/TestCharacterSet.swift @@ -7,14 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) -import Foundation -import XCTest -#else -import SwiftFoundation -import SwiftXCTest -#endif - private struct Box: Equatable { private let ns: NSCharacterSet private let swift: CharacterSet diff --git a/TestFoundation/TestCodable.swift b/TestFoundation/TestCodable.swift index 63d827183d..6726183063 100644 --- a/TestFoundation/TestCodable.swift +++ b/TestFoundation/TestCodable.swift @@ -7,14 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) -import Foundation -import XCTest -#else -import SwiftFoundation -import SwiftXCTest -#endif - // MARK: - Helper Functions private func makePersonNameComponents(namePrefix: String? = nil, diff --git a/TestFoundation/TestDate.swift b/TestFoundation/TestDate.swift index 567f6ed51b..8fdb008b07 100644 --- a/TestFoundation/TestDate.swift +++ b/TestFoundation/TestDate.swift @@ -7,18 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // - - -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) - import Foundation - import XCTest -#else - import SwiftFoundation - import SwiftXCTest -#endif - - - class TestDate : XCTestCase { static var allTests: [(String, (TestDate) -> () throws -> Void)] { diff --git a/TestFoundation/TestDateFormatter.swift b/TestFoundation/TestDateFormatter.swift index 04e625e280..2ba14339ae 100644 --- a/TestFoundation/TestDateFormatter.swift +++ b/TestFoundation/TestDateFormatter.swift @@ -7,14 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) - import Foundation - import XCTest -#else - import SwiftFoundation - import SwiftXCTest -#endif - class TestDateFormatter: XCTestCase { let DEFAULT_LOCALE = "en_US" diff --git a/TestFoundation/TestDecimal.swift b/TestFoundation/TestDecimal.swift index aad4bb2857..4df7d64d68 100644 --- a/TestFoundation/TestDecimal.swift +++ b/TestFoundation/TestDecimal.swift @@ -7,14 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) - import Foundation - import XCTest -#else - import SwiftFoundation - import SwiftXCTest -#endif - class TestDecimal: XCTestCase { static var allTests : [(String, (TestDecimal) -> () throws -> Void)] { diff --git a/TestFoundation/TestEnergyFormatter.swift b/TestFoundation/TestEnergyFormatter.swift index 20ee4f7a14..6ec4840c1f 100644 --- a/TestFoundation/TestEnergyFormatter.swift +++ b/TestFoundation/TestEnergyFormatter.swift @@ -7,14 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) - import Foundation - import XCTest -#else - import SwiftFoundation - import SwiftXCTest -#endif - class TestEnergyFormatter: XCTestCase { let formatter: EnergyFormatter = EnergyFormatter() diff --git a/TestFoundation/TestFileHandle.swift b/TestFoundation/TestFileHandle.swift index 1b389ff0f7..ac7c4f4720 100644 --- a/TestFoundation/TestFileHandle.swift +++ b/TestFoundation/TestFileHandle.swift @@ -7,14 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) - import Foundation - import XCTest -#else - import SwiftFoundation - import SwiftXCTest -#endif - class TestFileHandle : XCTestCase { static var allTests : [(String, (TestFileHandle) -> () throws -> ())] { return [ diff --git a/TestFoundation/TestFileManager.swift b/TestFoundation/TestFileManager.swift index 579d9865db..873acbe3b8 100644 --- a/TestFoundation/TestFileManager.swift +++ b/TestFoundation/TestFileManager.swift @@ -7,14 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) - import Foundation - import XCTest -#else - import SwiftFoundation - import SwiftXCTest -#endif - class TestFileManager : XCTestCase { static var allTests: [(String, (TestFileManager) -> () throws -> Void)] { @@ -275,6 +267,7 @@ class TestFileManager : XCTestCase { } func test_fileSystemAttributes() { +#if !os(Android) let fm = FileManager.default let path = NSTemporaryDirectory() @@ -306,6 +299,7 @@ class TestFileManager : XCTestCase { } catch let err { XCTFail("\(err)") } +#endif } func test_setFileAttributes() { diff --git a/TestFoundation/TestHTTPCookie.swift b/TestFoundation/TestHTTPCookie.swift index 51aff27c6c..5ca445fbaf 100644 --- a/TestFoundation/TestHTTPCookie.swift +++ b/TestFoundation/TestHTTPCookie.swift @@ -7,14 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) - import Foundation - import XCTest -#else - import SwiftFoundation - import SwiftXCTest -#endif - class TestHTTPCookie: XCTestCase { static var allTests: [(String, (TestHTTPCookie) -> () throws -> Void)] { diff --git a/TestFoundation/TestHTTPCookieStorage.swift b/TestFoundation/TestHTTPCookieStorage.swift index 2a44e0dbe2..0339f2cf4a 100644 --- a/TestFoundation/TestHTTPCookieStorage.swift +++ b/TestFoundation/TestHTTPCookieStorage.swift @@ -7,13 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) - import Foundation - import XCTest -#else - import SwiftFoundation - import SwiftXCTest -#endif import Dispatch class TestHTTPCookieStorage: XCTestCase { diff --git a/TestFoundation/TestHost.swift b/TestFoundation/TestHost.swift index 40b63d4da5..6cdb090363 100644 --- a/TestFoundation/TestHost.swift +++ b/TestFoundation/TestHost.swift @@ -7,16 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // - -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) - import Foundation - import XCTest -#else - import SwiftFoundation - import SwiftXCTest -#endif - - class TestHost: XCTestCase { static var allTests: [(String, (TestHost) -> () throws -> Void)] { diff --git a/TestFoundation/TestISO8601DateFormatter.swift b/TestFoundation/TestISO8601DateFormatter.swift index 9f6323ec5f..3511414a46 100644 --- a/TestFoundation/TestISO8601DateFormatter.swift +++ b/TestFoundation/TestISO8601DateFormatter.swift @@ -7,16 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // - - -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) - import Foundation - import XCTest -#else - import SwiftFoundation - import SwiftXCTest -#endif - class TestISO8601DateFormatter: XCTestCase { static var allTests : [(String, (TestISO8601DateFormatter) -> () throws -> Void)] { diff --git a/TestFoundation/TestImports.swift b/TestFoundation/TestImports.swift new file mode 100644 index 0000000000..60b48b6cf3 --- /dev/null +++ b/TestFoundation/TestImports.swift @@ -0,0 +1,18 @@ +// This source file is part of the Swift.org open source project +// +// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See http://swift.org/LICENSE.txt for license information +// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors +// + +// Centralized conditional imports for all test sources + +#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) || os(Android) +@_exported import Foundation +@_exported import XCTest +#else +@_exported import SwiftFoundation +@_exported import SwiftXCTest +#endif diff --git a/TestFoundation/TestIndexPath.swift b/TestFoundation/TestIndexPath.swift index c78e3cc6c4..bc4a6d1d86 100644 --- a/TestFoundation/TestIndexPath.swift +++ b/TestFoundation/TestIndexPath.swift @@ -7,16 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // - -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) - import Foundation - import XCTest -#else - import SwiftFoundation - import SwiftXCTest -#endif - - class TestIndexPath: XCTestCase { static var allTests: [(String, (TestIndexPath) -> () throws -> Void)] { diff --git a/TestFoundation/TestIndexSet.swift b/TestFoundation/TestIndexSet.swift index 4f8ab70d18..fbf9636563 100644 --- a/TestFoundation/TestIndexSet.swift +++ b/TestFoundation/TestIndexSet.swift @@ -7,16 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // - -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) -import Foundation -import XCTest -#else -import SwiftFoundation -import SwiftXCTest -#endif - - class TestIndexSet : XCTestCase { static var allTests: [(String, (TestIndexSet) -> () throws -> Void)] { diff --git a/TestFoundation/TestJSONEncoder.swift b/TestFoundation/TestJSONEncoder.swift index 915e3e3add..9932a0f8f9 100644 --- a/TestFoundation/TestJSONEncoder.swift +++ b/TestFoundation/TestJSONEncoder.swift @@ -7,14 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) - import Foundation - import XCTest -#else - import SwiftFoundation - import SwiftXCTest -#endif - struct TopLevelObjectWrapper: Codable, Equatable { var value: T diff --git a/TestFoundation/TestJSONSerialization.swift b/TestFoundation/TestJSONSerialization.swift index 06a68ee277..c11f311d77 100644 --- a/TestFoundation/TestJSONSerialization.swift +++ b/TestFoundation/TestJSONSerialization.swift @@ -7,15 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // - -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) - import Foundation - import XCTest -#else - import SwiftFoundation - import SwiftXCTest -#endif - // Exposing internal ReadingOptions for tests. extension JSONSerialization.ReadingOptions { fileprivate static let useReferenceNumericTypes = JSONSerialization.ReadingOptions(rawValue: 1 << 15) diff --git a/TestFoundation/TestLengthFormatter.swift b/TestFoundation/TestLengthFormatter.swift index c99d305992..e01c34b2ed 100644 --- a/TestFoundation/TestLengthFormatter.swift +++ b/TestFoundation/TestLengthFormatter.swift @@ -7,14 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) - import Foundation - import XCTest -#else - import SwiftFoundation - import SwiftXCTest -#endif - class TestLengthFormatter: XCTestCase { let formatter: LengthFormatter = LengthFormatter() diff --git a/TestFoundation/TestMassFormatter.swift b/TestFoundation/TestMassFormatter.swift index e465b1e121..84c8a46ba1 100644 --- a/TestFoundation/TestMassFormatter.swift +++ b/TestFoundation/TestMassFormatter.swift @@ -7,14 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) - import Foundation - import XCTest -#else - import SwiftFoundation - import SwiftXCTest -#endif - class TestMassFormatter: XCTestCase { let formatter: MassFormatter = MassFormatter() diff --git a/TestFoundation/TestNSArray.swift b/TestFoundation/TestNSArray.swift index b292c41728..b37aea9aa4 100644 --- a/TestFoundation/TestNSArray.swift +++ b/TestFoundation/TestNSArray.swift @@ -7,18 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // - - -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) -import Foundation -import XCTest -#else -import SwiftFoundation -import SwiftXCTest -#endif - - - class TestNSArray : XCTestCase { static var allTests: [(String, (TestNSArray) -> () throws -> Void)] { diff --git a/TestFoundation/TestNSAttributedString.swift b/TestFoundation/TestNSAttributedString.swift index 308b5958dd..ac66c0464b 100644 --- a/TestFoundation/TestNSAttributedString.swift +++ b/TestFoundation/TestNSAttributedString.swift @@ -7,17 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // - - -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) - import Foundation - import XCTest -#else - import SwiftFoundation - import SwiftXCTest -#endif - - class TestNSAttributedString : XCTestCase { static var allTests: [(String, (TestNSAttributedString) -> () throws -> Void)] { @@ -192,10 +181,6 @@ class TestNSAttributedString : XCTestCase { } func test_enumerateAttributes() { -#if os(Android) - // Invalid dictionary returned by CFAttributedStringGetAttributesAndLongestEffectiveRange - XCTFail("Intermittent failures on Android") -#else let string = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus consectetur et sem vitae consectetur. Nam venenatis lectus a laoreet blandit." let attrKey1 = NSAttributedStringKey("attribute.placeholder.key1") @@ -254,7 +239,6 @@ class TestNSAttributedString : XCTestCase { } XCTAssertEqual(rangeDescriptionString, "(0,10)") XCTAssertEqual(attrsDescriptionString, "[attribute.placeholder.key1:attribute.placeholder.value1]") -#endif } func test_copy() { diff --git a/TestFoundation/TestNSCache.swift b/TestFoundation/TestNSCache.swift index 76ec60b1b0..b66b48c8a9 100644 --- a/TestFoundation/TestNSCache.swift +++ b/TestFoundation/TestNSCache.swift @@ -7,14 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) - import Foundation - import XCTest -#else - import SwiftFoundation - import SwiftXCTest -#endif - class TestNSCache : XCTestCase { static var allTests: [(String, (TestNSCache) -> () throws -> Void)] { diff --git a/TestFoundation/TestNSCompoundPredicate.swift b/TestFoundation/TestNSCompoundPredicate.swift index c5647ba2fb..23407d6339 100644 --- a/TestFoundation/TestNSCompoundPredicate.swift +++ b/TestFoundation/TestNSCompoundPredicate.swift @@ -7,14 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) - import Foundation - import XCTest -#else - import SwiftFoundation - import SwiftXCTest -#endif - class TestNSCompoundPredicate: XCTestCase { static var allTests: [(String, (TestNSCompoundPredicate) -> () throws -> Void)] { diff --git a/TestFoundation/TestNSData.swift b/TestFoundation/TestNSData.swift index 77f812c1a3..a720a8efa3 100644 --- a/TestFoundation/TestNSData.swift +++ b/TestFoundation/TestNSData.swift @@ -7,14 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) - import Foundation - import XCTest -#else - import SwiftFoundation - import SwiftXCTest -#endif - class TestNSData: LoopbackServerTest { class AllOnesImmutableData : NSData { diff --git a/TestFoundation/TestNSDictionary.swift b/TestFoundation/TestNSDictionary.swift index fb342488a6..c68655968f 100644 --- a/TestFoundation/TestNSDictionary.swift +++ b/TestFoundation/TestNSDictionary.swift @@ -7,18 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // - - -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) -import Foundation -import XCTest -#else -import SwiftFoundation -import SwiftXCTest -#endif - - - class TestNSDictionary : XCTestCase { static var allTests: [(String, (TestNSDictionary) -> () throws -> Void)] { diff --git a/TestFoundation/TestNSError.swift b/TestFoundation/TestNSError.swift index 16094bbef7..2337a5b29d 100644 --- a/TestFoundation/TestNSError.swift +++ b/TestFoundation/TestNSError.swift @@ -7,15 +7,6 @@ // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // - -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) - import Foundation - import XCTest -#else - import SwiftFoundation - import SwiftXCTest -#endif - struct SwiftCustomNSError: Error, CustomNSError { } diff --git a/TestFoundation/TestNSGeometry.swift b/TestFoundation/TestNSGeometry.swift index 3c662f99d3..977f398144 100644 --- a/TestFoundation/TestNSGeometry.swift +++ b/TestFoundation/TestNSGeometry.swift @@ -7,15 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // - -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) - import Foundation - import XCTest -#else - import SwiftFoundation - import SwiftXCTest -#endif - private func assertEqual(_ rect: CGRect, x: CGFloat, y: CGFloat, diff --git a/TestFoundation/TestNSKeyedArchiver.swift b/TestFoundation/TestNSKeyedArchiver.swift index 73ab559c9b..889a5e1853 100644 --- a/TestFoundation/TestNSKeyedArchiver.swift +++ b/TestFoundation/TestNSKeyedArchiver.swift @@ -7,15 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // - -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) - import Foundation - import XCTest -#else - import SwiftFoundation - import SwiftXCTest -#endif - public class NSUserClass : NSObject, NSSecureCoding { var ivar : Int diff --git a/TestFoundation/TestNSKeyedUnarchiver.swift b/TestFoundation/TestNSKeyedUnarchiver.swift index 51b494f862..6f9007dc31 100644 --- a/TestFoundation/TestNSKeyedUnarchiver.swift +++ b/TestFoundation/TestNSKeyedUnarchiver.swift @@ -7,16 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // - -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) - import Foundation - import XCTest -#else - import SwiftFoundation - import SwiftXCTest -#endif - - class TestNSKeyedUnarchiver : XCTestCase { static var allTests: [(String, (TestNSKeyedUnarchiver) -> () throws -> Void)] { return [ diff --git a/TestFoundation/TestNSLocale.swift b/TestFoundation/TestNSLocale.swift index e29449670c..8f72bbc359 100644 --- a/TestFoundation/TestNSLocale.swift +++ b/TestFoundation/TestNSLocale.swift @@ -7,14 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) - import Foundation - import XCTest -#else - import SwiftFoundation - import SwiftXCTest -#endif - class TestNSLocale : XCTestCase { static var allTests: [(String, (TestNSLocale) -> () throws -> Void)] { return [ diff --git a/TestFoundation/TestNSLock.swift b/TestFoundation/TestNSLock.swift index 5334ff0cd8..a86365815b 100644 --- a/TestFoundation/TestNSLock.swift +++ b/TestFoundation/TestNSLock.swift @@ -7,14 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) -import Foundation -import XCTest -#else -import SwiftFoundation -import SwiftXCTest -#endif - class TestNSLock: XCTestCase { static var allTests: [(String, (TestNSLock) -> () throws -> Void)] { return [ diff --git a/TestFoundation/TestNSNull.swift b/TestFoundation/TestNSNull.swift index 08cc7c94ba..50eddeda9a 100644 --- a/TestFoundation/TestNSNull.swift +++ b/TestFoundation/TestNSNull.swift @@ -7,18 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // - - -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) - import Foundation - import XCTest -#else - import SwiftFoundation - import SwiftXCTest -#endif - - - class TestNSNull : XCTestCase { static var allTests: [(String, (TestNSNull) -> () throws -> Void)] { diff --git a/TestFoundation/TestNSNumber.swift b/TestFoundation/TestNSNumber.swift index 8dc25a0183..4c74e15f9b 100644 --- a/TestFoundation/TestNSNumber.swift +++ b/TestFoundation/TestNSNumber.swift @@ -7,16 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // - -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) -import Foundation -import XCTest -#else -import SwiftFoundation -import SwiftXCTest -#endif - - class TestNSNumber : XCTestCase { static var allTests: [(String, (TestNSNumber) -> () throws -> Void)] { return [ @@ -1083,37 +1073,40 @@ class TestNSNumber : XCTestCase { func test_stringValue() { + // The following casts on subtraction are required for an Android compile + // https://bugs.swift.org/browse/SR-7469 + if UInt.max == UInt32.max { XCTAssertEqual(NSNumber(value: UInt.min).stringValue, "0") XCTAssertEqual(NSNumber(value: UInt.min + 1).stringValue, "1") XCTAssertEqual(NSNumber(value: UInt.max).stringValue, "4294967295") - XCTAssertEqual(NSNumber(value: UInt.max - 1).stringValue, "4294967294") + XCTAssertEqual(NSNumber(value: UInt.max - 1 as UInt).stringValue, "4294967294") } else if UInt.max == UInt64.max { XCTAssertEqual(NSNumber(value: UInt.min).stringValue, "0") XCTAssertEqual(NSNumber(value: UInt.min + 1).stringValue, "1") XCTAssertEqual(NSNumber(value: UInt.max).stringValue, "18446744073709551615") - XCTAssertEqual(NSNumber(value: UInt.max - 1).stringValue, "18446744073709551614") + XCTAssertEqual(NSNumber(value: UInt.max - 1 as UInt).stringValue, "18446744073709551614") } XCTAssertEqual(NSNumber(value: UInt8.min).stringValue, "0") XCTAssertEqual(NSNumber(value: UInt8.min + 1).stringValue, "1") XCTAssertEqual(NSNumber(value: UInt8.max).stringValue, "255") - XCTAssertEqual(NSNumber(value: UInt8.max - 1).stringValue, "254") + XCTAssertEqual(NSNumber(value: UInt8.max - 1 as UInt8).stringValue, "254") XCTAssertEqual(NSNumber(value: UInt16.min).stringValue, "0") XCTAssertEqual(NSNumber(value: UInt16.min + 1).stringValue, "1") XCTAssertEqual(NSNumber(value: UInt16.max).stringValue, "65535") - XCTAssertEqual(NSNumber(value: UInt16.max - 1).stringValue, "65534") + XCTAssertEqual(NSNumber(value: UInt16.max - 1 as UInt16).stringValue, "65534") XCTAssertEqual(NSNumber(value: UInt32.min).stringValue, "0") XCTAssertEqual(NSNumber(value: UInt32.min + 1).stringValue, "1") XCTAssertEqual(NSNumber(value: UInt32.max).stringValue, "4294967295") - XCTAssertEqual(NSNumber(value: UInt32.max - 1).stringValue, "4294967294") + XCTAssertEqual(NSNumber(value: UInt32.max - 1 as UInt32).stringValue, "4294967294") XCTAssertEqual(NSNumber(value: UInt64.min).stringValue, "0") XCTAssertEqual(NSNumber(value: UInt64.min + 1).stringValue, "1") XCTAssertEqual(NSNumber(value: UInt64.max).stringValue, "18446744073709551615") - XCTAssertEqual(NSNumber(value: UInt64.max - 1).stringValue, "18446744073709551614") + XCTAssertEqual(NSNumber(value: UInt64.max - 1 as UInt64).stringValue, "18446744073709551614") if Int.max == Int32.max { XCTAssertEqual(NSNumber(value: Int.min).stringValue, "-2147483648") diff --git a/TestFoundation/TestNSNumberBridging.swift b/TestFoundation/TestNSNumberBridging.swift index 986a67406c..57978b1fbc 100644 --- a/TestFoundation/TestNSNumberBridging.swift +++ b/TestFoundation/TestNSNumberBridging.swift @@ -7,15 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // - -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) -import Foundation -import XCTest -#else -import SwiftFoundation -import SwiftXCTest -#endif - class TestNSNumberBridging : XCTestCase { static var allTests: [(String, (TestNSNumberBridging) -> () throws -> Void)] { return [ diff --git a/TestFoundation/TestNSOrderedSet.swift b/TestFoundation/TestNSOrderedSet.swift index 855c901fe1..d8b3231fa9 100644 --- a/TestFoundation/TestNSOrderedSet.swift +++ b/TestFoundation/TestNSOrderedSet.swift @@ -7,18 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // - - -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) - import Foundation - import XCTest -#else - import SwiftFoundation - import SwiftXCTest -#endif - - - class TestNSOrderedSet : XCTestCase { static var allTests: [(String, (TestNSOrderedSet) -> () throws -> Void)] { diff --git a/TestFoundation/TestNSPredicate.swift b/TestFoundation/TestNSPredicate.swift index 4e88e33e42..3e755dc506 100644 --- a/TestFoundation/TestNSPredicate.swift +++ b/TestFoundation/TestNSPredicate.swift @@ -7,14 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) - import Foundation - import XCTest -#else - import SwiftFoundation - import SwiftXCTest -#endif - class TestNSPredicate: XCTestCase { static var allTests : [(String, (TestNSPredicate) -> () throws -> Void)] { diff --git a/TestFoundation/TestNSProgressFraction.swift b/TestFoundation/TestNSProgressFraction.swift index 7dcdd65990..05a6e3817a 100644 --- a/TestFoundation/TestNSProgressFraction.swift +++ b/TestFoundation/TestNSProgressFraction.swift @@ -7,14 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) -import Foundation -import XCTest -#else -import SwiftFoundation -import SwiftXCTest -#endif - #if !DARWIN_COMPATIBILITY_TESTS class TestProgressFraction : XCTestCase { static var allTests: [(String, (TestProgressFraction) -> () throws -> Void)] { diff --git a/TestFoundation/TestNSRange.swift b/TestFoundation/TestNSRange.swift index 5574d3488e..8b3870fd2a 100644 --- a/TestFoundation/TestNSRange.swift +++ b/TestFoundation/TestNSRange.swift @@ -7,16 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // - -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) -import Foundation -import XCTest -#else -import SwiftFoundation -import SwiftXCTest -#endif - - class TestNSRange : XCTestCase { static var allTests: [(String, (TestNSRange) -> () throws -> Void)] { diff --git a/TestFoundation/TestNSRegularExpression.swift b/TestFoundation/TestNSRegularExpression.swift index 55edf21788..419ba3b3ec 100644 --- a/TestFoundation/TestNSRegularExpression.swift +++ b/TestFoundation/TestNSRegularExpression.swift @@ -7,18 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // - - -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) -import Foundation -import XCTest -#else -import SwiftFoundation -import SwiftXCTest -#endif - - - class TestNSRegularExpression : XCTestCase { static var allTests : [(String, (TestNSRegularExpression) -> () throws -> Void)] { diff --git a/TestFoundation/TestNSSet.swift b/TestFoundation/TestNSSet.swift index 8b27af26ca..f6d5c5a688 100644 --- a/TestFoundation/TestNSSet.swift +++ b/TestFoundation/TestNSSet.swift @@ -7,18 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // - - -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) -import Foundation -import XCTest -#else -import SwiftFoundation -import SwiftXCTest -#endif - - - class TestNSSet : XCTestCase { static var allTests: [(String, (TestNSSet) -> () throws -> Void)] { diff --git a/TestFoundation/TestNSString.swift b/TestFoundation/TestNSString.swift index e63edd9184..eb9184319e 100755 --- a/TestFoundation/TestNSString.swift +++ b/TestFoundation/TestNSString.swift @@ -7,15 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // - -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) -import Foundation -import XCTest -#else -import SwiftFoundation -import SwiftXCTest -#endif - import CoreFoundation #if os(macOS) || os(iOS) diff --git a/TestFoundation/TestNSTextCheckingResult.swift b/TestFoundation/TestNSTextCheckingResult.swift index a631434f59..303045577b 100644 --- a/TestFoundation/TestNSTextCheckingResult.swift +++ b/TestFoundation/TestNSTextCheckingResult.swift @@ -7,16 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // - - -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) - import Foundation - import XCTest -#else - import SwiftFoundation - import SwiftXCTest -#endif - class TestNSTextCheckingResult: XCTestCase { static var allTests: [(String, (TestNSTextCheckingResult) -> () throws -> Void)] { return [ diff --git a/TestFoundation/TestNSURLRequest.swift b/TestFoundation/TestNSURLRequest.swift index 01bc34e741..da10012c76 100644 --- a/TestFoundation/TestNSURLRequest.swift +++ b/TestFoundation/TestNSURLRequest.swift @@ -7,15 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // - -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) - import Foundation - import XCTest -#else - import SwiftFoundation - import SwiftXCTest -#endif - class TestNSURLRequest : XCTestCase { static var allTests: [(String, (TestNSURLRequest) -> () throws -> Void)] { diff --git a/TestFoundation/TestNSUUID.swift b/TestFoundation/TestNSUUID.swift index 8122357955..47a17fe7ca 100644 --- a/TestFoundation/TestNSUUID.swift +++ b/TestFoundation/TestNSUUID.swift @@ -7,16 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // - -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) - import Foundation - import XCTest -#else - import SwiftFoundation - import SwiftXCTest -#endif - - class TestNSUUID : XCTestCase { static var allTests: [(String, (TestNSUUID) -> () throws -> Void)] { diff --git a/TestFoundation/TestNSValue.swift b/TestFoundation/TestNSValue.swift index 367485f3ea..7ebba664e4 100644 --- a/TestFoundation/TestNSValue.swift +++ b/TestFoundation/TestNSValue.swift @@ -7,16 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // - -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) - import Foundation - import XCTest -#else - import SwiftFoundation - import SwiftXCTest -#endif - - class TestNSValue : XCTestCase { static var allTests: [(String, (TestNSValue) -> () throws -> Void)] { return [ diff --git a/TestFoundation/TestNotification.swift b/TestFoundation/TestNotification.swift index 9c1bd38fac..8044e31a30 100644 --- a/TestFoundation/TestNotification.swift +++ b/TestFoundation/TestNotification.swift @@ -7,18 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // - - -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) - import Foundation - import XCTest -#else - import SwiftFoundation - import SwiftXCTest -#endif - - - class TestNotification : XCTestCase { static var allTests: [(String, (TestNotification) -> () throws -> Void)] { diff --git a/TestFoundation/TestNotificationCenter.swift b/TestFoundation/TestNotificationCenter.swift index 76c7052786..c94b109044 100644 --- a/TestFoundation/TestNotificationCenter.swift +++ b/TestFoundation/TestNotificationCenter.swift @@ -7,16 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // - -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) - import Foundation - import XCTest -#else - import SwiftFoundation - import SwiftXCTest -#endif - - class TestNotificationCenter : XCTestCase { static var allTests: [(String, (TestNotificationCenter) -> () throws -> Void)] { return [ diff --git a/TestFoundation/TestNotificationQueue.swift b/TestFoundation/TestNotificationQueue.swift index 9bde72607f..f1440ff0b8 100644 --- a/TestFoundation/TestNotificationQueue.swift +++ b/TestFoundation/TestNotificationQueue.swift @@ -7,15 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) - import Foundation - import XCTest -#else - import SwiftFoundation - import SwiftXCTest -#endif - - class TestNotificationQueue : XCTestCase { static var allTests : [(String, (TestNotificationQueue) -> () throws -> Void)] { return [ diff --git a/TestFoundation/TestNumberFormatter.swift b/TestFoundation/TestNumberFormatter.swift index 47c66a552d..c97c5ba32a 100644 --- a/TestFoundation/TestNumberFormatter.swift +++ b/TestFoundation/TestNumberFormatter.swift @@ -7,14 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) - import Foundation - import XCTest -#else - import SwiftFoundation - import SwiftXCTest -#endif - class TestNumberFormatter: XCTestCase { static var allTests: [(String, (TestNumberFormatter) -> () throws -> Void)] { diff --git a/TestFoundation/TestObjCRuntime.swift b/TestFoundation/TestObjCRuntime.swift index 4af4094a16..324d5d0bba 100644 --- a/TestFoundation/TestObjCRuntime.swift +++ b/TestFoundation/TestObjCRuntime.swift @@ -7,14 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) - import Foundation - import XCTest -#else - import SwiftFoundation - import SwiftXCTest -#endif - class SwiftClass { class InnerClass {} } diff --git a/TestFoundation/TestOperationQueue.swift b/TestFoundation/TestOperationQueue.swift index 1dd8c50a29..e78e68634f 100644 --- a/TestFoundation/TestOperationQueue.swift +++ b/TestFoundation/TestOperationQueue.swift @@ -7,15 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // - - -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) -import Foundation -import XCTest -#else -import SwiftFoundation -import SwiftXCTest -#endif import Dispatch class TestOperationQueue : XCTestCase { diff --git a/TestFoundation/TestPersonNameComponents.swift b/TestFoundation/TestPersonNameComponents.swift index a747e9ca85..ffbfae6662 100644 --- a/TestFoundation/TestPersonNameComponents.swift +++ b/TestFoundation/TestPersonNameComponents.swift @@ -7,16 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // - - -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) - import Foundation - import XCTest -#else - import SwiftFoundation - import SwiftXCTest -#endif - private func assertEqual(_ lhs:PersonNameComponents, _ rhs: PersonNameComponents, file: StaticString = #file, diff --git a/TestFoundation/TestPipe.swift b/TestFoundation/TestPipe.swift index ea655b30ad..35dded6524 100644 --- a/TestFoundation/TestPipe.swift +++ b/TestFoundation/TestPipe.swift @@ -7,16 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // - -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) -import Foundation -import XCTest -#else -import SwiftFoundation -import SwiftXCTest -#endif - - class TestPipe : XCTestCase { static var allTests: [(String, (TestPipe) -> () throws -> Void)] { diff --git a/TestFoundation/TestProcess.swift b/TestFoundation/TestProcess.swift index 6af3e37df3..f450ebcb33 100644 --- a/TestFoundation/TestProcess.swift +++ b/TestFoundation/TestProcess.swift @@ -7,14 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) - import Foundation - import XCTest -#else - import SwiftFoundation - import SwiftXCTest -#endif - class TestProcess : XCTestCase { static var allTests: [(String, (TestProcess) -> () throws -> Void)] { #if os(Android) diff --git a/TestFoundation/TestProcessInfo.swift b/TestFoundation/TestProcessInfo.swift index fee4e1d21b..e8e646c3da 100644 --- a/TestFoundation/TestProcessInfo.swift +++ b/TestFoundation/TestProcessInfo.swift @@ -7,16 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // - -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) - import Foundation - import XCTest -#else - import SwiftFoundation - import SwiftXCTest -#endif - - class TestProcessInfo : XCTestCase { static var allTests: [(String, (TestProcessInfo) -> () throws -> Void)] { diff --git a/TestFoundation/TestProgress.swift b/TestFoundation/TestProgress.swift index f9a9798098..8bf3708ad4 100644 --- a/TestFoundation/TestProgress.swift +++ b/TestFoundation/TestProgress.swift @@ -7,14 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) -import Foundation -import XCTest -#else -import SwiftFoundation -import SwiftXCTest -#endif - import Dispatch class TestProgress : XCTestCase { diff --git a/TestFoundation/TestPropertyListSerialization.swift b/TestFoundation/TestPropertyListSerialization.swift index 0f921b0488..8b02661f0c 100644 --- a/TestFoundation/TestPropertyListSerialization.swift +++ b/TestFoundation/TestPropertyListSerialization.swift @@ -7,17 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // - -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) -import Foundation -import XCTest -#else -import SwiftFoundation -import SwiftXCTest -#endif - - - class TestPropertyListSerialization : XCTestCase { static var allTests: [(String, (TestPropertyListSerialization) -> () throws -> Void)] { return [ diff --git a/TestFoundation/TestRunLoop.swift b/TestFoundation/TestRunLoop.swift index 9100b269f2..e427cde165 100644 --- a/TestFoundation/TestRunLoop.swift +++ b/TestFoundation/TestRunLoop.swift @@ -7,15 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) - import Foundation - import XCTest -#else - import SwiftFoundation - import SwiftXCTest -#endif - - class TestRunLoop : XCTestCase { static var allTests : [(String, (TestRunLoop) -> () throws -> Void)] { return [ diff --git a/TestFoundation/TestScanner.swift b/TestFoundation/TestScanner.swift index 2a1804ecc2..c2330b04eb 100644 --- a/TestFoundation/TestScanner.swift +++ b/TestFoundation/TestScanner.swift @@ -7,18 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // - - -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) - import Foundation - import XCTest -#else - import SwiftFoundation - import SwiftXCTest -#endif - - - class TestScanner : XCTestCase { static var allTests: [(String, (TestScanner) -> () throws -> Void)] { diff --git a/TestFoundation/TestStream.swift b/TestFoundation/TestStream.swift index 8584bba7b6..f1a6759c85 100644 --- a/TestFoundation/TestStream.swift +++ b/TestFoundation/TestStream.swift @@ -7,14 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) - import Foundation - import XCTest -#else - import SwiftFoundation - import SwiftXCTest -#endif - class TestStream : XCTestCase { static var allTests: [(String, (TestStream) -> () throws -> Void)] { return [ diff --git a/TestFoundation/TestThread.swift b/TestFoundation/TestThread.swift index 4a73d095ff..68efcb63ec 100644 --- a/TestFoundation/TestThread.swift +++ b/TestFoundation/TestThread.swift @@ -7,15 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // - -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) - import Foundation - import XCTest -#else - import SwiftFoundation - import SwiftXCTest -#endif - #if !(os(macOS) || os(iOS)) import CoreFoundation #endif diff --git a/TestFoundation/TestTimeZone.swift b/TestFoundation/TestTimeZone.swift index 2bbb523fc8..e605fa03f1 100644 --- a/TestFoundation/TestTimeZone.swift +++ b/TestFoundation/TestTimeZone.swift @@ -7,18 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // - - -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) - import Foundation - import XCTest -#else - import SwiftFoundation - import SwiftXCTest -#endif - - - class TestTimeZone: XCTestCase { static var allTests: [(String, (TestTimeZone) -> () throws -> Void)] { diff --git a/TestFoundation/TestTimer.swift b/TestFoundation/TestTimer.swift index d66435f56b..ceac0a6adf 100644 --- a/TestFoundation/TestTimer.swift +++ b/TestFoundation/TestTimer.swift @@ -7,16 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // - -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) - import Foundation - import XCTest -#else - import SwiftFoundation - import SwiftXCTest -#endif - - class TestTimer : XCTestCase { static var allTests : [(String, (TestTimer) -> () throws -> Void)] { return [ diff --git a/TestFoundation/TestURL.swift b/TestFoundation/TestURL.swift index 4f435a0158..6cdbcc4aa8 100644 --- a/TestFoundation/TestURL.swift +++ b/TestFoundation/TestURL.swift @@ -7,16 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // - -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) -import Foundation -import XCTest -#else -import SwiftFoundation -import SwiftXCTest -#endif - - let kURLTestParsingTestsKey = "ParsingTests" let kURLTestTitleKey = "In-Title" diff --git a/TestFoundation/TestURLCredential.swift b/TestFoundation/TestURLCredential.swift index bcb588d624..eb33366996 100644 --- a/TestFoundation/TestURLCredential.swift +++ b/TestFoundation/TestURLCredential.swift @@ -7,15 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // - -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) - import Foundation - import XCTest -#else - import SwiftFoundation - import SwiftXCTest -#endif - class TestURLCredential : XCTestCase { static var allTests: [(String, (TestURLCredential) -> () throws -> Void)] { diff --git a/TestFoundation/TestURLProtocol.swift b/TestFoundation/TestURLProtocol.swift index 2db78a076c..fcb964809a 100644 --- a/TestFoundation/TestURLProtocol.swift +++ b/TestFoundation/TestURLProtocol.swift @@ -6,13 +6,6 @@ // See http://swift.org/LICENSE.txt for license information // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) -import Foundation -import XCTest -#else -import SwiftFoundation -import SwiftXCTest -#endif class TestURLProtocol : LoopbackServerTest { diff --git a/TestFoundation/TestURLRequest.swift b/TestFoundation/TestURLRequest.swift index e23ceacdf1..a5035c4eef 100644 --- a/TestFoundation/TestURLRequest.swift +++ b/TestFoundation/TestURLRequest.swift @@ -7,15 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // - -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) - import Foundation - import XCTest -#else - import SwiftFoundation - import SwiftXCTest -#endif - class TestURLRequest : XCTestCase { static var allTests: [(String, (TestURLRequest) -> () throws -> Void)] { diff --git a/TestFoundation/TestURLResponse.swift b/TestFoundation/TestURLResponse.swift index 44fc95bbef..f2797ba457 100644 --- a/TestFoundation/TestURLResponse.swift +++ b/TestFoundation/TestURLResponse.swift @@ -7,16 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // - -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) - import Foundation - import XCTest -#else - import SwiftFoundation - import SwiftXCTest -#endif - - class TestURLResponse : XCTestCase { static var allTests: [(String, (TestURLResponse) -> () throws -> Void)] { return [ diff --git a/TestFoundation/TestURLSession.swift b/TestFoundation/TestURLSession.swift index 22bb0b9de6..161f9530dd 100644 --- a/TestFoundation/TestURLSession.swift +++ b/TestFoundation/TestURLSession.swift @@ -7,14 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) - import Foundation - import XCTest -#else - import SwiftFoundation - import SwiftXCTest -#endif - class TestURLSession : LoopbackServerTest { static var allTests: [(String, (TestURLSession) -> () throws -> Void)] { diff --git a/TestFoundation/TestUnit.swift b/TestFoundation/TestUnit.swift index c934965729..6837974c24 100644 --- a/TestFoundation/TestUnit.swift +++ b/TestFoundation/TestUnit.swift @@ -7,14 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) - import Foundation - import XCTest -#else - import SwiftFoundation - import SwiftXCTest -#endif - class TestUnit: XCTestCase { static var allTests: [(String, (TestUnit) -> () throws -> Void)] { diff --git a/TestFoundation/TestUnitConverter.swift b/TestFoundation/TestUnitConverter.swift index ed1d37477b..01545c5cdf 100644 --- a/TestFoundation/TestUnitConverter.swift +++ b/TestFoundation/TestUnitConverter.swift @@ -7,16 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) - import Foundation - import XCTest -#else - import SwiftFoundation - import SwiftXCTest -#endif - - - class TestUnitConverter: XCTestCase { static var allTests: [(String, (TestUnitConverter) -> () throws -> Void)] { diff --git a/TestFoundation/TestUserDefaults.swift b/TestFoundation/TestUserDefaults.swift index dfba9bad52..9094fc7d6e 100644 --- a/TestFoundation/TestUserDefaults.swift +++ b/TestFoundation/TestUserDefaults.swift @@ -7,14 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) - import Foundation - import XCTest -#else - import SwiftFoundation - import SwiftXCTest -#endif - class TestUserDefaults : XCTestCase { static var allTests : [(String, (TestUserDefaults) -> () throws -> ())] { return [ diff --git a/TestFoundation/TestUtils.swift b/TestFoundation/TestUtils.swift index 860e1291d9..b2c28f9a70 100644 --- a/TestFoundation/TestUtils.swift +++ b/TestFoundation/TestUtils.swift @@ -7,14 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) - import Foundation - import XCTest -#else - import SwiftFoundation - import SwiftXCTest -#endif - func ensureFiles(_ fileNames: [String]) -> Bool { var result = true let fm = FileManager.default diff --git a/TestFoundation/TestXMLDocument.swift b/TestFoundation/TestXMLDocument.swift index ee62114e71..56ed296343 100644 --- a/TestFoundation/TestXMLDocument.swift +++ b/TestFoundation/TestXMLDocument.swift @@ -7,16 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // - -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) - import Foundation - import XCTest -#else - import SwiftFoundation - import SwiftXCTest -#endif - - class TestXMLDocument : LoopbackServerTest { static var allTests: [(String, (TestXMLDocument) -> () throws -> Void)] { diff --git a/TestFoundation/TestXMLParser.swift b/TestFoundation/TestXMLParser.swift index 36ac9cc882..24a3281b56 100644 --- a/TestFoundation/TestXMLParser.swift +++ b/TestFoundation/TestXMLParser.swift @@ -7,15 +7,6 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // - -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) - import Foundation - import XCTest -#else - import SwiftFoundation - import SwiftXCTest -#endif - enum XMLParserDelegateEvent { case startDocument case endDocument diff --git a/TestFoundation/XDGTestHelper.swift b/TestFoundation/XDGTestHelper.swift index 15099abc9d..566489bff3 100644 --- a/TestFoundation/XDGTestHelper.swift +++ b/TestFoundation/XDGTestHelper.swift @@ -7,7 +7,7 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -#if os(Linux) +#if os(Linux) || os(Android) import Foundation #else import SwiftFoundation diff --git a/TestFoundation/main.swift b/TestFoundation/main.swift index c2c3c0a660..4afe1b54a6 100644 --- a/TestFoundation/main.swift +++ b/TestFoundation/main.swift @@ -7,21 +7,14 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) -import Foundation -import XCTest -#else -import SwiftFoundation -import SwiftXCTest -#endif +// Most imports now centraized in TestImports.swift -#if os(macOS) || os(iOS) +#if canImport(Darwin) import Darwin -#elseif os(Linux) +#elseif canImport(Glibc) import Glibc #endif - // ignore SIGPIPE which is sent when writing to closed file descriptors. _ = signal(SIGPIPE, SIG_IGN) diff --git a/TestFoundation/xdgTestHelper/main.swift b/TestFoundation/xdgTestHelper/main.swift index 19b12fda60..c883b2843e 100644 --- a/TestFoundation/xdgTestHelper/main.swift +++ b/TestFoundation/xdgTestHelper/main.swift @@ -7,7 +7,7 @@ // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -#if os(Linux) +#if os(Linux) || os(Android) import Foundation #else import SwiftFoundation