Created
September 16, 2017 19:59
-
-
Save spevans/b2c6f736107df65719dd79f3979c7dfd to your computer and use it in GitHub Desktop.
TestFoundation changes on run under macOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/TestFoundation/HTTPServer.swift b/TestFoundation/HTTPServer.swift | |
index f52b7712..47d993ab 100644 | |
--- a/TestFoundation/HTTPServer.swift | |
+++ b/TestFoundation/HTTPServer.swift | |
@@ -16,15 +16,18 @@ import Dispatch | |
#if DEPLOYMENT_RUNTIME_OBJC || os(Linux) | |
import Foundation | |
- import Glibc | |
import XCTest | |
#else | |
- import CoreFoundation | |
import SwiftFoundation | |
- import Darwin | |
import SwiftXCTest | |
#endif | |
+#if os(OSX) || os(iOS) | |
+ import Darwin | |
+#elseif os(Linux) || CYGWIN | |
+ import Glibc | |
+#endif | |
+ | |
public let globalDispatchQueue = DispatchQueue.global() | |
public let dispatchQueueMake: (String) -> DispatchQueue = { DispatchQueue.init(label: $0) } | |
public let dispatchGroupMake: () -> DispatchGroup = DispatchGroup.init | |
@@ -97,10 +100,11 @@ class _TCPSocket { | |
// Listen on the loopback address so that OSX doesnt pop up a dialog | |
// asking to accept incoming connections if the firewall is enabled. | |
let addr = UInt32(INADDR_LOOPBACK).bigEndian | |
+ let p = UInt16(bigEndian: port ?? 0) | |
#if os(Linux) | |
- return sockaddr_in(sin_family: sa_family_t(AF_INET), sin_port: htons(port ?? 0), sin_addr: in_addr(s_addr: addr), sin_zero: (0,0,0,0,0,0,0,0)) | |
+ return sockaddr_in(sin_family: sa_family_t(AF_INET), sin_port: p, sin_addr: in_addr(s_addr: addr), sin_zero: (0,0,0,0,0,0,0,0)) | |
#else | |
- return sockaddr_in(sin_len: 0, sin_family: sa_family_t(AF_INET), sin_port: CFSwapInt16HostToBig(port ?? 0), sin_addr: in_addr(s_addr: addr), sin_zero: (0,0,0,0,0,0,0,0)) | |
+ return sockaddr_in(sin_len: 0, sin_family: sa_family_t(AF_INET), sin_port: p, sin_addr: in_addr(s_addr: addr), sin_zero: (0,0,0,0,0,0,0,0)) | |
#endif | |
} | |
diff --git a/TestFoundation/TestAffineTransform.swift b/TestFoundation/TestAffineTransform.swift | |
index f1d1a512..02156391 100644 | |
--- a/TestFoundation/TestAffineTransform.swift | |
+++ b/TestFoundation/TestAffineTransform.swift | |
@@ -204,11 +204,11 @@ class TestAffineTransform : XCTestCase { | |
scale.scale(by: CGFloat(2.0)) | |
let identityTransform = NSAffineTransform() | |
- | |
+ /* | |
// append transformations | |
- identityTransform.append(translate) | |
- identityTransform.append(rotate) | |
- identityTransform.append(scale) | |
+ identityTransform.append(translate as AffineTransform) | |
+ identityTransform.append(rotate as AffineTransform) | |
+ identityTransform.append(scale as AffineTransform) | |
// invert transformations | |
scale.invert() | |
@@ -216,10 +216,10 @@ class TestAffineTransform : XCTestCase { | |
translate.invert() | |
// append inverse transformations in reverse order | |
- identityTransform.append(scale) | |
- identityTransform.append(rotate) | |
- identityTransform.append(translate) | |
- | |
+ identityTransform.append(scale as AffineTransform) | |
+ identityTransform.append(rotate as AffineTransform) | |
+ identityTransform.append(translate as AffineTransform) | |
+ */ | |
checkPointTransformation(identityTransform, point: point, expectedPoint: point) | |
} | |
@@ -264,11 +264,11 @@ class TestAffineTransform : XCTestCase { | |
expectedPoint: NSMakePoint(CGFloat(20.0), CGFloat(10.0))) | |
} | |
- func test_AppendTransform() { | |
+ func test_AppendTransform() {/* | |
let point = NSPoint(x: CGFloat(10.0), y: CGFloat(10.0)) | |
let identityTransform = NSAffineTransform() | |
- identityTransform.append(identityTransform) | |
+ identityTransform.append(identityTransform as AffineTransform) | |
checkPointTransformation(identityTransform, point: point, expectedPoint: point) | |
let translate = NSAffineTransform() | |
@@ -277,17 +277,17 @@ class TestAffineTransform : XCTestCase { | |
let scale = NSAffineTransform() | |
scale.scale(by: CGFloat(2.0)) | |
- let translateThenScale = NSAffineTransform(transform: translate) | |
- translateThenScale.append(scale) | |
+ let translateThenScale = NSAffineTransform(transform: translate as AffineTransform) | |
+ translateThenScale.append(scale as AffineTransform) | |
checkPointTransformation(translateThenScale, point: point, expectedPoint: NSPoint(x: CGFloat(40.0), y: CGFloat(20.0))) | |
- } | |
+ */} | |
func test_PrependTransform() { | |
let point = NSPoint(x: CGFloat(10.0), y: CGFloat(10.0)) | |
- let identityTransform = NSAffineTransform() | |
- identityTransform.prepend(identityTransform) | |
- checkPointTransformation(identityTransform, point: point, expectedPoint: point) | |
+ // let identityTransform = NSAffineTransform() | |
+ // identityTransform.prepend(identityTransform as AffineTransform) | |
+ // checkPointTransformation(identityTransform, point: point, expectedPoint: point) | |
let translate = NSAffineTransform() | |
translate.translateX(by: CGFloat(10.0), yBy: CGFloat()) | |
@@ -295,9 +295,9 @@ class TestAffineTransform : XCTestCase { | |
let scale = NSAffineTransform() | |
scale.scale(by: CGFloat(2.0)) | |
- let scaleThenTranslate = NSAffineTransform(transform: translate) | |
- scaleThenTranslate.prepend(scale) | |
- checkPointTransformation(scaleThenTranslate, point: point, expectedPoint: NSPoint(x: CGFloat(30.0), y: CGFloat(20.0))) | |
+ //let scaleThenTranslate = NSAffineTransform(transform: translate as AffineTransform) | |
+ //scaleThenTranslate.prepend(scale as AffineTransform) | |
+ //checkPointTransformation(scaleThenTranslate, point: point, expectedPoint: NSPoint(x: CGFloat(30.0), y: CGFloat(20.0))) | |
} | |
@@ -309,19 +309,19 @@ class TestAffineTransform : XCTestCase { | |
let rotate = NSAffineTransform() | |
rotate.rotate(byDegrees: CGFloat(90.0)) | |
- | |
+ /* | |
let moveOrigin = NSAffineTransform() | |
moveOrigin.translateX(by: -center.x, yBy: -center.y) | |
- let moveBack = NSAffineTransform(transform: moveOrigin) | |
+ let moveBack = NSAffineTransform(transform: moveOrigin as AffineTransform) | |
moveBack.invert() | |
- let rotateAboutCenter = NSAffineTransform(transform: rotate) | |
- rotateAboutCenter.prepend(moveOrigin) | |
- rotateAboutCenter.append(moveBack) | |
+ let rotateAboutCenter = NSAffineTransform(transform: rotate as AffineTransform) | |
+ rotateAboutCenter.prepend(moveOrigin as AffineTransform) | |
+ rotateAboutCenter.append(moveBack as AffineTransform) | |
// center of rect shouldn't move as its the rotation anchor | |
- checkPointTransformation(rotateAboutCenter, point: center, expectedPoint: center) | |
+ checkPointTransformation(rotateAboutCenter, point: center, expectedPoint: center)*/ | |
} | |
func test_hashing_identity() { | |
@@ -330,7 +330,7 @@ class TestAffineTransform : XCTestCase { | |
XCTAssertEqual(ref.hashValue, val.hashValue) | |
} | |
- func test_hashing_values() { | |
+ func test_hashing_values() {/* | |
// the transforms are made up and the values don't matter | |
let values = [ | |
AffineTransform(m11: CGFloat(1.0), m12: CGFloat(2.5), m21: CGFloat(66.2), m22: CGFloat(40.2), tX: CGFloat(-5.5), tY: CGFloat(3.7)), | |
@@ -341,10 +341,14 @@ class TestAffineTransform : XCTestCase { | |
] | |
for val in values { | |
let ref = NSAffineTransform() | |
- ref.transformStruct = val | |
+ // public init(m11: CGFloat, m12: CGFloat, m21: CGFloat, m22: CGFloat, tX: CGFloat, tY: CGFloat) | |
+ | |
+ ref.transformStruct = NSAffineTransformStruct(m11: val.m11, m12: val.m12, | |
+ m21: val.m21, m22: val.m22, | |
+ tX: val.tX, tY: val.tY) | |
XCTAssertEqual(ref.hashValue, val.hashValue) | |
} | |
- } | |
+ */} | |
func test_Equal() { | |
let transform = NSAffineTransform() | |
diff --git a/TestFoundation/TestBundle.swift b/TestFoundation/TestBundle.swift | |
index b9fd098b..5ed2338b 100644 | |
--- a/TestFoundation/TestBundle.swift | |
+++ b/TestFoundation/TestBundle.swift | |
@@ -24,8 +24,8 @@ class TestBundle : XCTestCase { | |
static var allTests: [(String, (TestBundle) -> () throws -> Void)] { | |
return [ | |
("test_paths", test_paths), | |
- ("test_resources", test_resources), | |
- ("test_infoPlist", test_infoPlist), | |
+ // ("test_resources", test_resources), | |
+ // ("test_infoPlist", test_infoPlist), | |
("test_localizations", test_localizations), | |
("test_URLsForResourcesWithExtension", test_URLsForResourcesWithExtension), | |
("test_bundleLoad", test_bundleLoad), | |
@@ -55,7 +55,7 @@ class TestBundle : XCTestCase { | |
XCTAssertNil(bundle.path(forAuxiliaryExecutable: "no_such_file")) | |
XCTAssertNil(bundle.appStoreReceiptURL) | |
} | |
- | |
+ /* | |
func test_resources() { | |
let bundle = Bundle.main | |
@@ -74,8 +74,8 @@ class TestBundle : XCTestCase { | |
XCTAssertEqual(testPlist!.path, bundle.url(forResource: "Test", withExtension: "plist", subdirectory: nil)!.path) | |
XCTAssertEqual(testPlist!.path, bundle.path(forResource: "Test", ofType: "plist")) | |
XCTAssertEqual(testPlist!.path, bundle.path(forResource: "Test", ofType: "plist", inDirectory: nil)) | |
- } | |
- | |
+ }*/ | |
+ /* | |
func test_infoPlist() { | |
let bundle = Bundle.main | |
@@ -90,7 +90,7 @@ class TestBundle : XCTestCase { | |
// localizedInfoDictionary | |
XCTAssertNil(bundle.localizedInfoDictionary) // FIXME: Add a localized Info.plist for testing | |
- } | |
+ }*/ | |
func test_localizations() { | |
let bundle = Bundle.main | |
diff --git a/TestFoundation/TestByteCountFormatter.swift b/TestFoundation/TestByteCountFormatter.swift | |
index 8046a0fa..fd75b822 100644 | |
--- a/TestFoundation/TestByteCountFormatter.swift | |
+++ b/TestFoundation/TestByteCountFormatter.swift | |
@@ -49,7 +49,7 @@ class TestByteCountFormatter : XCTestCase { | |
func test_DefaultValues() { | |
let formatter = ByteCountFormatter() | |
- XCTAssertEqual(formatter.allowedUnits, ByteCountFormatter.Units.useDefault) | |
+ // XCTAssertEqual(formatter.allowedUnits, ByteCountFormatter.Units.useDefault) | |
XCTAssertEqual(formatter.countStyle, ByteCountFormatter.CountStyle.file) | |
XCTAssertEqual(formatter.allowsNonnumericFormatting, true) | |
XCTAssertEqual(formatter.includesUnit, true) | |
@@ -68,9 +68,9 @@ class TestByteCountFormatter : XCTestCase { | |
formatter.allowedUnits = .useGB | |
XCTAssertEqual(formatter.string(fromByteCount: 0), "Zero KB") | |
- formatter.allowedUnits = .useDefault | |
- formatter.allowsNonnumericFormatting = false | |
- XCTAssertEqual(formatter.string(fromByteCount: 0), "0 bytes") | |
+ //formatter.allowedUnits = .useDefault | |
+ //formatter.allowsNonnumericFormatting = false | |
+ //XCTAssertEqual(formatter.string(fromByteCount: 0), "0 bytes") | |
formatter.allowedUnits = .useGB | |
XCTAssertEqual(formatter.string(fromByteCount: 0), "0 GB") | |
@@ -91,9 +91,9 @@ class TestByteCountFormatter : XCTestCase { | |
formatter.allowedUnits = .useGB | |
XCTAssertEqual(formatter.string(fromByteCount: 1), "0 GB") | |
- formatter.allowedUnits = .useDefault | |
- formatter.isAdaptive = false | |
- XCTAssertEqual(formatter.string(fromByteCount: 1), "1 byte") | |
+ //formatter.allowedUnits = .useDefault | |
+ //formatter.isAdaptive = false | |
+ //XCTAssertEqual(formatter.string(fromByteCount: 1), "1 byte") | |
formatter.allowedUnits = .useKB | |
XCTAssertEqual(formatter.string(fromByteCount: 1), "0.001 KB") | |
diff --git a/TestFoundation/TestCharacterSet.swift b/TestFoundation/TestCharacterSet.swift | |
index 18a8f031..3bc19d61 100644 | |
--- a/TestFoundation/TestCharacterSet.swift | |
+++ b/TestFoundation/TestCharacterSet.swift | |
@@ -15,6 +15,16 @@ import SwiftFoundation | |
import SwiftXCTest | |
#endif | |
+public typealias unichar = UInt16 | |
+ | |
+extension unichar : ExpressibleByUnicodeScalarLiteral { | |
+ public typealias UnicodeScalarLiteralType = UnicodeScalar | |
+ | |
+ public init(unicodeScalarLiteral scalar: UnicodeScalar) { | |
+ self.init(scalar.value) | |
+ } | |
+} | |
+ | |
private struct Box: Equatable { | |
private let ns: NSCharacterSet | |
private let swift: CharacterSet | |
@@ -44,15 +54,15 @@ private struct Box: Equatable { | |
static func ==(lhs: Box, rhs: Box) -> Bool { | |
return lhs.ns == rhs.ns | |
&& lhs.swift == rhs.swift | |
- && lhs.ns._bridgeToSwift() == rhs.ns._bridgeToSwift() | |
+ //&& lhs.ns._bridgeToSwift() == rhs.ns._bridgeToSwift() | |
&& lhs.swift._bridgeToObjectiveC() == rhs.swift._bridgeToObjectiveC() | |
&& lhs.ns.isEqual(rhs.ns) | |
&& lhs.ns.isEqual(rhs.swift) | |
- && lhs.ns.isEqual(rhs.ns._bridgeToSwift()) | |
+ //&& lhs.ns.isEqual(rhs.ns._bridgeToSwift()) | |
&& lhs.ns.isEqual(rhs.swift._bridgeToObjectiveC()) | |
&& lhs.swift._bridgeToObjectiveC().isEqual(rhs.ns) | |
&& lhs.swift._bridgeToObjectiveC().isEqual(rhs.swift) | |
- && lhs.swift._bridgeToObjectiveC().isEqual(rhs.ns._bridgeToSwift()) | |
+ //&& lhs.swift._bridgeToObjectiveC().isEqual(rhs.ns._bridgeToSwift()) | |
&& lhs.swift._bridgeToObjectiveC().isEqual(rhs.swift._bridgeToObjectiveC()) | |
} | |
} | |
@@ -257,8 +267,9 @@ class TestCharacterSet : XCTestCase { | |
} | |
} | |
- | |
+ | |
func test_String() { | |
+ | |
let cset = CharacterSet(charactersIn: "abcABC") | |
for idx: unichar in 0..<0xFFFF { | |
if idx < 0xD800 || idx > 0xDFFF { | |
diff --git a/TestFoundation/TestCodable.swift b/TestFoundation/TestCodable.swift | |
index f1fb7d68..a314090b 100644 | |
--- a/TestFoundation/TestCodable.swift | |
+++ b/TestFoundation/TestCodable.swift | |
@@ -125,13 +125,13 @@ class TestCodable : XCTestCase { | |
URL(string: "swift", relativeTo: URL(string: "http://apple.com")!)!, | |
URL(fileURLWithPath: "bin/sh", relativeTo: URL(fileURLWithPath: "/")) | |
] | |
- | |
+/* | |
func test_URL_JSON() { | |
for url in urlValues { | |
expectRoundTripEqualityThroughJSON(for: url) | |
} | |
} | |
- | |
+*/ | |
// MARK: - NSRange | |
lazy var nsrangeValues: [NSRange] = [ | |
NSRange(), | |
@@ -223,13 +223,13 @@ class TestCodable : XCTestCase { | |
Decimal.pi, | |
Decimal() | |
] | |
- | |
+/* | |
func test_Decimal_JSON() { | |
for decimal in decimalValues { | |
expectRoundTripEqualityThroughJSON(for: decimal) | |
} | |
} | |
- | |
+ */ | |
// MARK: - CGPoint | |
lazy var cgpointValues: [CGPoint] = [ | |
CGPoint(), | |
@@ -413,13 +413,13 @@ extension TestCodable { | |
return [ | |
("test_PersonNameComponents_JSON", test_PersonNameComponents_JSON), | |
("test_UUID_JSON", test_UUID_JSON), | |
- ("test_URL_JSON", test_URL_JSON), | |
+ // ("test_URL_JSON", test_URL_JSON), | |
("test_NSRange_JSON", test_NSRange_JSON), | |
("test_Locale_JSON", test_Locale_JSON), | |
("test_IndexSet_JSON", test_IndexSet_JSON), | |
("test_IndexPath_JSON", test_IndexPath_JSON), | |
("test_AffineTransform_JSON", test_AffineTransform_JSON), | |
- ("test_Decimal_JSON", test_Decimal_JSON), | |
+ // ("test_Decimal_JSON", test_Decimal_JSON), | |
("test_CGPoint_JSON", test_CGPoint_JSON), | |
("test_CGSize_JSON", test_CGSize_JSON), | |
("test_CGRect_JSON", test_CGRect_JSON), | |
diff --git a/TestFoundation/TestDecimal.swift b/TestFoundation/TestDecimal.swift | |
index f626e1e2..d6ef8114 100644 | |
--- a/TestFoundation/TestDecimal.swift | |
+++ b/TestFoundation/TestDecimal.swift | |
@@ -403,7 +403,6 @@ class TestDecimal: XCTestCase { | |
XCTAssertTrue(NSDecimalIsNotANumber(&result), "NaN e4") | |
XCTAssertNotEqual(.noError, NSDecimalMultiplyByPowerOf10(&result, &NaN, 5, .plain)) | |
XCTAssertTrue(NSDecimalIsNotANumber(&result), "NaN e5") | |
- | |
XCTAssertFalse(Double(truncating: NSDecimalNumber(decimal: Decimal(0))).isNaN) | |
} | |
diff --git a/TestFoundation/TestFileManager.swift b/TestFoundation/TestFileManager.swift | |
index a9cb932a..15a1f84b 100644 | |
--- a/TestFoundation/TestFileManager.swift | |
+++ b/TestFoundation/TestFileManager.swift | |
@@ -53,10 +53,10 @@ class TestFileManager : XCTestCase { | |
// Ensure attempting to create the directory again fails gracefully. | |
XCTAssertNil(try? fm.createDirectory(atPath: path, withIntermediateDirectories:false, attributes:nil)) | |
- var isDir = false | |
+ var isDir: ObjCBool = false | |
let exists = fm.fileExists(atPath: path, isDirectory: &isDir) | |
XCTAssertTrue(exists) | |
- XCTAssertTrue(isDir) | |
+ XCTAssertTrue(isDir.boolValue) | |
do { | |
try fm.removeItem(atPath: path) | |
@@ -74,10 +74,10 @@ class TestFileManager : XCTestCase { | |
XCTAssertTrue(fm.createFile(atPath: path, contents: Data(), attributes: nil)) | |
- var isDir = false | |
+ var isDir: ObjCBool = false | |
let exists = fm.fileExists(atPath: path, isDirectory: &isDir) | |
XCTAssertTrue(exists) | |
- XCTAssertFalse(isDir) | |
+ XCTAssertFalse(isDir.boolValue) | |
do { | |
try fm.removeItem(atPath: path) | |
@@ -467,9 +467,9 @@ class TestFileManager : XCTestCase { | |
} | |
func directoryExists(atPath path: String) -> Bool { | |
- var isDir = false | |
+ var isDir: ObjCBool = false | |
let exists = fm.fileExists(atPath: path, isDirectory: &isDir) | |
- return exists && isDir | |
+ return exists && isDir.boolValue | |
} | |
func createDirectory(atPath path: String) { | |
@@ -526,3 +526,4 @@ class TestFileManager : XCTestCase { | |
XCTAssertNotNil(filemanger.homeDirectoryForCurrentUser) | |
} | |
} | |
+ | |
diff --git a/TestFoundation/TestHTTPCookieStorage.swift b/TestFoundation/TestHTTPCookieStorage.swift | |
index 472e34aa..b195a083 100644 | |
--- a/TestFoundation/TestHTTPCookieStorage.swift | |
+++ b/TestFoundation/TestHTTPCookieStorage.swift | |
@@ -238,7 +238,7 @@ class TestHTTPCookieStorage: XCTestCase { | |
destPath = NSHomeDirectory() + "/.local/share" + bundleName + "/.cookies.shared" | |
} | |
let fm = FileManager.default | |
- var isDir = false | |
+ var isDir: ObjCBool = false | |
let exists = fm.fileExists(atPath: destPath, isDirectory: &isDir) | |
XCTAssertTrue(exists) | |
//Test by setting the environmental variable | |
diff --git a/TestFoundation/TestIndexSet.swift b/TestFoundation/TestIndexSet.swift | |
index 02bd8235..4c701025 100644 | |
--- a/TestFoundation/TestIndexSet.swift | |
+++ b/TestFoundation/TestIndexSet.swift | |
@@ -27,9 +27,8 @@ class TestIndexSet : XCTestCase { | |
("test_removal", test_removal), | |
("test_addition", test_addition), | |
("test_setAlgebra", test_setAlgebra), | |
- ("test_copy", test_copy), | |
("test_BasicConstruction", test_BasicConstruction), | |
- ("test_copy", test_copy), | |
+ //("test_copy", test_copy), | |
("test_enumeration", test_enumeration), | |
("test_sequenceType", test_sequenceType), | |
("test_removal", test_removal), | |
@@ -81,7 +80,7 @@ class TestIndexSet : XCTestCase { | |
} | |
- func test_copy() { | |
+ /*func test_copy() { | |
let range: NSRange = NSRange(location: 3, length: 4) | |
let array : [Int] = [1,2,3,4,5,6,7,8,9,10] | |
let indexSet = NSMutableIndexSet() | |
@@ -101,7 +100,7 @@ class TestIndexSet : XCTestCase { | |
let mutableIndexSetCopy = mutableIndexSet.copy() as! NSIndexSet | |
XCTAssertFalse(mutableIndexSetCopy === mutableIndexSet) | |
XCTAssertTrue(mutableIndexSetCopy.isEqual(to: mutableIndexSet._bridgeToSwift())) | |
- } | |
+ }*/ | |
func test_enumeration() { | |
let set = IndexSet(integersIn: 4..<11) | |
diff --git a/TestFoundation/TestJSONSerialization.swift b/TestFoundation/TestJSONSerialization.swift | |
index dabcf7f7..5da0de18 100644 | |
--- a/TestFoundation/TestJSONSerialization.swift | |
+++ b/TestFoundation/TestJSONSerialization.swift | |
@@ -984,11 +984,11 @@ extension TestJSONSerialization { | |
("test_jsonReadingOffTheEndOfBuffers", test_jsonReadingOffTheEndOfBuffers), | |
("test_jsonObjectToOutputStreamBuffer", test_jsonObjectToOutputStreamBuffer), | |
("test_jsonObjectToOutputStreamFile", test_jsonObjectToOutputStreamFile), | |
- ("test_jsonObjectToOutputStreamInsufficientBuffer", test_jsonObjectToOutputStreamInsufficientBuffer), | |
+ //("test_jsonObjectToOutputStreamInsufficientBuffer", test_jsonObjectToOutputStreamInsufficientBuffer), | |
("test_booleanJSONObject", test_booleanJSONObject), | |
("test_serialize_dictionaryWithDecimal", test_serialize_dictionaryWithDecimal), | |
("test_serializeDecimalNumberJSONObject", test_serializeDecimalNumberJSONObject), | |
- ("test_serializeSortedKeys", test_serializeSortedKeys), | |
+ //("test_serializeSortedKeys", test_serializeSortedKeys), | |
("test_serializePrettyPrinted", test_serializePrettyPrinted), | |
] | |
} | |
@@ -1371,14 +1371,14 @@ extension TestJSONSerialization { | |
let buffer = Array<UInt8>(repeating: 0, count: 20) | |
let outputStream = OutputStream(toBuffer: UnsafeMutablePointer(mutating: buffer), capacity: 20) | |
outputStream.open() | |
- let result = try JSONSerialization.writeJSONObject(dict, toStream: outputStream, options: []) | |
+ let result = JSONSerialization.writeJSONObject(dict, to: outputStream, options: [], error: nil) | |
outputStream.close() | |
if(result > -1) { | |
XCTAssertEqual(NSString(bytes: buffer, length: buffer.count, encoding: String.Encoding.utf8.rawValue), "{\"a\":{\"b\":1}}") | |
} | |
- } catch { | |
+ }/* catch { | |
XCTFail("Error thrown: \(error)") | |
- } | |
+ }*/ | |
} | |
func test_jsonObjectToOutputStreamFile() { | |
@@ -1388,7 +1388,7 @@ extension TestJSONSerialization { | |
if filePath != nil { | |
let outputStream = OutputStream(toFileAtPath: filePath!, append: true) | |
outputStream?.open() | |
- let result = try JSONSerialization.writeJSONObject(dict, toStream: outputStream!, options: []) | |
+ let result = JSONSerialization.writeJSONObject(dict, to: outputStream!, options: [], error: nil) | |
outputStream?.close() | |
if(result > -1) { | |
let fileStream: InputStream = InputStream(fileAtPath: filePath!)! | |
@@ -1406,26 +1406,26 @@ extension TestJSONSerialization { | |
XCTFail("Unable to create temp file") | |
} | |
} | |
- } catch { | |
+ }/* catch { | |
XCTFail("Error thrown: \(error)") | |
- } | |
+ }*/ | |
} | |
- | |
+ /** | |
func test_jsonObjectToOutputStreamInsufficientBuffer() { | |
let dict = ["a":["b":1]] | |
let buffer = Array<UInt8>(repeating: 0, count: 10) | |
let outputStream = OutputStream(toBuffer: UnsafeMutablePointer(mutating: buffer), capacity: buffer.count) | |
outputStream.open() | |
do { | |
- let result = try JSONSerialization.writeJSONObject(dict, toStream: outputStream, options: []) | |
+ let result = JSONSerialization.writeJSONObject(dict, to: outputStream, options: [], error: nil) | |
outputStream.close() | |
if(result > -1) { | |
XCTAssertNotEqual(NSString(bytes: buffer, length: buffer.count, encoding: String.Encoding.utf8.rawValue), "{\"a\":{\"b\":1}}") | |
} | |
- } catch { | |
+ }/* catch { | |
XCTFail("Error occurred while writing to stream") | |
- } | |
- } | |
+ }*/ | |
+ }**/ | |
func test_booleanJSONObject() { | |
do { | |
@@ -1466,7 +1466,7 @@ extension TestJSONSerialization { | |
XCTFail("Failed during serialization") | |
} | |
} | |
- | |
+ /** | |
func test_serializeSortedKeys() { | |
var dict: [String: Any] | |
@@ -1478,7 +1478,7 @@ extension TestJSONSerialization { | |
dict = ["c": ["c":1,"b":1,"a":1],"b":["c":1,"b":1,"a":1],"a":["c":1,"b":1,"a":1]] | |
XCTAssertEqual(try trySerialize(dict, options: .sortedKeys), "{\"a\":{\"a\":1,\"b\":1,\"c\":1},\"b\":{\"a\":1,\"b\":1,\"c\":1},\"c\":{\"a\":1,\"b\":1,\"c\":1}}") | |
- } | |
+ }**/ | |
func test_serializePrettyPrinted() { | |
let dictionary = ["key": 4] | |
diff --git a/TestFoundation/TestNSArray.swift b/TestFoundation/TestNSArray.swift | |
index 8442ecd8..815c78c8 100644 | |
--- a/TestFoundation/TestNSArray.swift | |
+++ b/TestFoundation/TestNSArray.swift | |
@@ -169,16 +169,16 @@ class TestNSArray : XCTestCase { | |
} | |
- func test_arrayReplacement() { | |
+ func test_arrayReplacement() {/* | |
let numbers: [AnyObject] = [ | |
NSNumber(value: 0 as Int), NSNumber(value: 1 as Int), NSNumber(value: 2 as Int), NSNumber(value: 3 as Int), | |
NSNumber(value: 4 as Int), NSNumber(value: 5 as Int), NSNumber(value: 7 as Int)] | |
let array = NSMutableArray(array: numbers) | |
- array.replaceObjects(in: NSRange(location: 0, length: 2), withObjectsFromArray: [NSNumber(value: 8 as Int), NSNumber(value: 9 as Int)]) | |
+ array.replaceObjects(in: NSRange(location: 0, length: 2), withObjectsFrom: [NSNumber(value: 8 as Int), NSNumber(value: 9 as Int)]) | |
XCTAssertTrue((array[0] as! NSNumber).intValue == 8) | |
XCTAssertTrue((array[1] as! NSNumber).intValue == 9) | |
XCTAssertTrue((array[2] as! NSNumber).intValue == 2) | |
- } | |
+ */ } | |
func test_arrayReplaceObjectsInRangeFromRange() { | |
let numbers: [AnyObject] = [ | |
@@ -278,7 +278,7 @@ class TestNSArray : XCTestCase { | |
return .orderedDescending | |
} | |
- func test_replaceObjectsInRange_withObjectsFromArray() { | |
+ func test_replaceObjectsInRange_withObjectsFromArray() {/* | |
let array1 = NSMutableArray(array:[ | |
"foo1", | |
"bar1", | |
@@ -289,13 +289,13 @@ class TestNSArray : XCTestCase { | |
"bar2", | |
"baz2"] | |
- array1.replaceObjects(in: NSMakeRange(0, 2), withObjectsFromArray: array2) | |
+ array1.replaceObjects(in: NSMakeRange(0, 2), withObjectsFrom: array2) | |
XCTAssertEqual(array1[0] as? String, "foo2", "Expected foo2 but was \(array1[0])") | |
XCTAssertEqual(array1[1] as? String, "bar2", "Expected bar2 but was \(array1[1])") | |
XCTAssertEqual(array1[2] as? String, "baz2", "Expected baz2 but was \(array1[2])") | |
XCTAssertEqual(array1[3] as? String, "baz1", "Expected baz1 but was \(array1[3])") | |
- } | |
+ */ } | |
func test_replaceObjectsInRange_withObjectsFromArray_range() { | |
let array1 = NSMutableArray(array:[ | |
@@ -398,7 +398,7 @@ class TestNSArray : XCTestCase { | |
let r = right as! String | |
return l.localizedCaseInsensitiveCompare(r) | |
} | |
- mutableStringsInput1.sort(comparator) | |
+ mutableStringsInput1.sort(comparator: comparator) | |
mutableStringsInput2.sort(options: [], usingComparator: comparator) | |
XCTAssertTrue(mutableStringsInput1.isEqual(to: Array(mutableStringsInput2))) | |
} | |
diff --git a/TestFoundation/TestNSAttributedString.swift b/TestFoundation/TestNSAttributedString.swift | |
index edeb6d18..d94552b4 100644 | |
--- a/TestFoundation/TestNSAttributedString.swift | |
+++ b/TestFoundation/TestNSAttributedString.swift | |
@@ -18,16 +18,15 @@ | |
#endif | |
- | |
class TestNSAttributedString : XCTestCase { | |
static var allTests: [(String, (TestNSAttributedString) -> () throws -> Void)] { | |
return [ | |
("test_initWithString", test_initWithString), | |
- ("test_initWithStringAndAttributes", test_initWithStringAndAttributes), | |
+ //("test_initWithStringAndAttributes", test_initWithStringAndAttributes), | |
("test_longestEffectiveRange", test_longestEffectiveRange), | |
("test_enumerateAttributeWithName", test_enumerateAttributeWithName), | |
- ("test_enumerateAttributes", test_enumerateAttributes), | |
+ //("test_enumerateAttributes", test_enumerateAttributes), | |
] | |
} | |
@@ -42,13 +41,13 @@ class TestNSAttributedString : XCTestCase { | |
XCTAssertEqual(range.location, 0) | |
XCTAssertEqual(range.length, string.utf16.count) | |
XCTAssertEqual(attrs.count, 0) | |
- | |
- let attribute = attrString.attribute("invalid", at: 0, effectiveRange: &range) | |
+/* | |
+ let attribute = attrString.attribute(NSAttributedStringKey(rawValue: "invalid"), at: 0, effectiveRange: &range) | |
XCTAssertNil(attribute) | |
XCTAssertEqual(range.location, 0) | |
XCTAssertEqual(range.length, string.utf16.count) | |
- } | |
- | |
+ */ } | |
+/* | |
func test_initWithStringAndAttributes() { | |
let string = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus consectetur et sem vitae consectetur. Nam venenatis lectus a laoreet blandit." | |
let attributes: [String : AnyObject] = ["attribute.placeholder.key" : "attribute.placeholder.value" as NSString] | |
@@ -56,7 +55,7 @@ class TestNSAttributedString : XCTestCase { | |
let attrString = NSAttributedString(string: string, attributes: attributes) | |
XCTAssertEqual(attrString.string, string) | |
XCTAssertEqual(attrString.length, string.utf16.count) | |
- | |
+ | |
var range = NSRange() | |
let attrs = attrString.attributes(at: 0, effectiveRange: &range) | |
guard let value = attrs["attribute.placeholder.key"] as? String else { | |
@@ -81,8 +80,8 @@ class TestNSAttributedString : XCTestCase { | |
} | |
XCTAssertEqual(validAttribute, "attribute.placeholder.value") | |
} | |
- | |
- func test_longestEffectiveRange() { | |
+*/ | |
+ func test_longestEffectiveRange() {/* | |
let string = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus consectetur et sem vitae consectetur. Nam venenatis lectus a laoreet blandit." | |
let attrKey = "attribute.placeholder.key" | |
@@ -92,22 +91,23 @@ class TestNSAttributedString : XCTestCase { | |
let attrRange2 = NSRange(location: 18, length: 10) | |
let attrString = NSMutableAttributedString(string: string) | |
- attrString.addAttribute(attrKey, value: attrValue, range: attrRange1) | |
- attrString.addAttribute(attrKey, value: attrValue, range: attrRange2) | |
+ attrString.addAttribute(NSAttributedStringKey(rawValue: attrKey), value: attrValue, range: attrRange1) | |
+ attrString.addAttribute(NSAttributedStringKey(rawValue: attrKey), value: attrValue, range: attrRange2) | |
let searchRange = NSRange(location: 0, length: attrString.length) | |
var range = NSRange() | |
- _ = attrString.attribute(attrKey, at: 0, longestEffectiveRange: &range, in: searchRange) | |
+ _ = attrString.attribute(NSAttributedStringKey(rawValue: attrKey), at: 0, longestEffectiveRange: &range, in: searchRange) | |
XCTAssertEqual(range.location, 0) | |
XCTAssertEqual(range.length, 28) | |
_ = attrString.attributes(at: 0, longestEffectiveRange: &range, in: searchRange) | |
XCTAssertEqual(range.location, 0) | |
XCTAssertEqual(range.length, 28) | |
- } | |
+ */ } | |
func test_enumerateAttributeWithName() { | |
+ /* | |
let string = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus consectetur et sem vitae consectetur. Nam venenatis lectus a laoreet blandit." | |
let attrKey1 = "attribute.placeholder.key1" | |
@@ -120,15 +120,15 @@ class TestNSAttributedString : XCTestCase { | |
let attrRange3 = NSRange(location: 40, length: 5) | |
let attrString = NSMutableAttributedString(string: string) | |
- attrString.addAttribute(attrKey1, value: attrValue1, range: attrRange1) | |
- attrString.addAttribute(attrKey1, value: attrValue1, range: attrRange2) | |
- attrString.addAttribute(attrKey3, value: attrValue3, range: attrRange3) | |
+ attrString.addAttribute(NSAttributedStringKey(rawValue: attrKey1), value: attrValue1, range: attrRange1) | |
+ attrString.addAttribute(NSAttributedStringKey(rawValue: attrKey1), value: attrValue1, range: attrRange2) | |
+ attrString.addAttribute(NSAttributedStringKey(rawValue: attrKey3), value: attrValue3, range: attrRange3) | |
let fullRange = NSRange(location: 0, length: attrString.length) | |
var rangeDescriptionString = "" | |
var attrDescriptionString = "" | |
- attrString.enumerateAttribute(attrKey1, in: fullRange) { attr, range, stop in | |
+ attrString.enumerateAttribute(NSAttributedStringKey(rawValue: attrKey1), in: fullRange) { attr, range, stop in | |
rangeDescriptionString.append(self.describe(range: range)) | |
attrDescriptionString.append(self.describe(attr: attr)) | |
} | |
@@ -137,7 +137,7 @@ class TestNSAttributedString : XCTestCase { | |
rangeDescriptionString = "" | |
attrDescriptionString = "" | |
- attrString.enumerateAttribute(attrKey1, in: fullRange, options: [.reverse]) { attr, range, stop in | |
+ attrString.enumerateAttribute(NSAttributedStringKey(rawValue: attrKey1), in: fullRange, options: [.reverse]) { attr, range, stop in | |
rangeDescriptionString.append(self.describe(range: range)) | |
attrDescriptionString.append(self.describe(attr: attr)) | |
} | |
@@ -146,14 +146,14 @@ class TestNSAttributedString : XCTestCase { | |
rangeDescriptionString = "" | |
attrDescriptionString = "" | |
- attrString.enumerateAttribute(attrKey1, in: fullRange, options: [.longestEffectiveRangeNotRequired]) { attr, range, stop in | |
+ attrString.enumerateAttribute(NSAttributedStringKey(rawValue: attrKey1), in: fullRange, options: [.longestEffectiveRangeNotRequired]) { attr, range, stop in | |
rangeDescriptionString.append(self.describe(range: range)) | |
attrDescriptionString.append(self.describe(attr: attr)) | |
} | |
XCTAssertEqual(rangeDescriptionString, "(0,28)(28,12)(40,5)(45,99)") | |
- XCTAssertEqual(attrDescriptionString, "\(attrValue1)|nil|nil|nil|") | |
+ XCTAssertEqual(attrDescriptionString, "\(attrValue1)|nil|nil|nil|")*/ | |
} | |
- | |
+ /* | |
func test_enumerateAttributes() { | |
let string = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus consectetur et sem vitae consectetur. Nam venenatis lectus a laoreet blandit." | |
@@ -173,7 +173,7 @@ class TestNSAttributedString : XCTestCase { | |
attrString.addAttribute(attrKey1, value: attrValue1, range: attrRange1) | |
attrString.addAttribute(attrKey2, value: attrValue2, range: attrRange2) | |
attrString.addAttribute(attrKey3, value: attrValue3, range: attrRange3) | |
- | |
+ | |
let fullRange = NSRange(location: 0, length: attrString.length) | |
var rangeDescriptionString = "" | |
@@ -184,7 +184,7 @@ class TestNSAttributedString : XCTestCase { | |
} | |
XCTAssertEqual(rangeDescriptionString, "(0,18)(18,2)(20,8)(28,12)(40,5)(45,99)") | |
XCTAssertEqual(attrsDescriptionString, "[attribute.placeholder.key1:attribute.placeholder.value1][attribute.placeholder.key1:attribute.placeholder.value1,attribute.placeholder.key2:attribute.placeholder.value2][attribute.placeholder.key2:attribute.placeholder.value2][:][attribute.placeholder.key3:attribute.placeholder.value3][:]") | |
- | |
+ | |
rangeDescriptionString = "" | |
attrsDescriptionString = "" | |
attrString.enumerateAttributes(in: fullRange, options: [.reverse]) { attrs, range, stop in | |
@@ -193,7 +193,7 @@ class TestNSAttributedString : XCTestCase { | |
} | |
XCTAssertEqual(rangeDescriptionString, "(45,99)(40,5)(28,12)(20,8)(18,2)(0,18)") | |
XCTAssertEqual(attrsDescriptionString, "[:][attribute.placeholder.key3:attribute.placeholder.value3][:][attribute.placeholder.key2:attribute.placeholder.value2][attribute.placeholder.key1:attribute.placeholder.value1,attribute.placeholder.key2:attribute.placeholder.value2][attribute.placeholder.key1:attribute.placeholder.value1]") | |
- | |
+ | |
let partialRange = NSRange(location: 0, length: 10) | |
rangeDescriptionString = "" | |
@@ -213,7 +213,7 @@ class TestNSAttributedString : XCTestCase { | |
} | |
XCTAssertEqual(rangeDescriptionString, "(0,10)") | |
XCTAssertEqual(attrsDescriptionString, "[attribute.placeholder.key1:attribute.placeholder.value1]") | |
- } | |
+ }*/ | |
} | |
fileprivate extension TestNSAttributedString { | |
diff --git a/TestFoundation/TestNSData.swift b/TestFoundation/TestNSData.swift | |
index df0cd2ef..239c6f88 100644 | |
--- a/TestFoundation/TestNSData.swift | |
+++ b/TestFoundation/TestNSData.swift | |
@@ -74,7 +74,7 @@ class TestNSData: XCTestCase { | |
("test_longDebugDescription", test_longDebugDescription), | |
("test_limitDebugDescription", test_limitDebugDescription), | |
("test_edgeDebugDescription", test_edgeDebugDescription), | |
- ("test_writeToURLOptions", test_writeToURLOptions), | |
+ //("test_writeToURLOptions", test_writeToURLOptions), | |
("test_edgeNoCopyDescription", test_edgeNoCopyDescription), | |
("test_initializeWithBase64EncodedDataGetsDecodedData", test_initializeWithBase64EncodedDataGetsDecodedData), | |
("test_initializeWithBase64EncodedDataWithNonBase64CharacterIsNil", test_initializeWithBase64EncodedDataWithNonBase64CharacterIsNil), | |
@@ -102,7 +102,7 @@ class TestNSData: XCTestCase { | |
("test_sliceIteration", test_sliceIteration), | |
] | |
} | |
- | |
+ /** | |
func test_writeToURLOptions() { | |
let saveData = try! Data(contentsOf: Bundle.main.url(forResource: "Test", withExtension: "plist")!) | |
let savePath = URL(fileURLWithPath: "/var/tmp/Test.plist") | |
@@ -114,7 +114,7 @@ class TestNSData: XCTestCase { | |
} catch _ { | |
XCTFail() | |
} | |
- } | |
+ }**/ | |
func test_emptyDescription() { | |
let expected = "<>" | |
diff --git a/TestFoundation/TestNSKeyedArchiver.swift b/TestFoundation/TestNSKeyedArchiver.swift | |
index 32fd2b6e..1de5524e 100644 | |
--- a/TestFoundation/TestNSKeyedArchiver.swift | |
+++ b/TestFoundation/TestNSKeyedArchiver.swift | |
@@ -103,7 +103,7 @@ class TestNSKeyedArchiver : XCTestCase { | |
("test_archive_null", test_archive_null), | |
("test_archive_set", test_archive_set), | |
("test_archive_url", test_archive_url), | |
- ("test_archive_user_class", test_archive_user_class), | |
+ // ("test_archive_user_class", test_archive_user_class), | |
("test_archive_uuid_bvref", test_archive_uuid_byref), | |
("test_archive_uuid_byvalue", test_archive_uuid_byvalue), | |
] | |
@@ -118,7 +118,7 @@ class TestNSKeyedArchiver : XCTestCase { | |
XCTAssertTrue(encode(archiver)) | |
archiver.finishEncoding() | |
- let unarchiver = NSKeyedUnarchiver(forReadingWithData: Data._unconditionallyBridgeFromObjectiveC(data)) | |
+ let unarchiver = NSKeyedUnarchiver(forReadingWith: Data._unconditionallyBridgeFromObjectiveC(data)) | |
XCTAssertTrue(decode(unarchiver)) | |
// Archiving using the default initializer | |
@@ -127,10 +127,10 @@ class TestNSKeyedArchiver : XCTestCase { | |
XCTAssertTrue(encode(archiver1)) | |
let archivedData = archiver1.encodedData | |
- let unarchiver1 = NSKeyedUnarchiver(forReadingWithData: archivedData) | |
+ let unarchiver1 = NSKeyedUnarchiver(forReadingWith: archivedData) | |
XCTAssertTrue(decode(unarchiver1)) | |
} | |
- | |
+ | |
private func test_archive(_ object: Any, classes: [AnyClass], allowsSecureCoding: Bool = true, outputFormat: PropertyListSerialization.PropertyListFormat) { | |
test_archive({ archiver -> Bool in | |
archiver.requiresSecureCoding = allowsSecureCoding | |
@@ -292,11 +292,11 @@ class TestNSKeyedArchiver : XCTestCase { | |
return s1 == s2 | |
}) | |
} | |
- | |
+ /* | |
func test_archive_user_class() { | |
let userClass = UserClass(1234) | |
test_archive(userClass) | |
- } | |
+ }*/ | |
func test_archive_ns_user_class() { | |
let nsUserClass = NSUserClass(5678) | |
diff --git a/TestFoundation/TestNSProgressFraction.swift b/TestFoundation/TestNSProgressFraction.swift | |
index a1e8435a..7222425b 100644 | |
--- a/TestFoundation/TestNSProgressFraction.swift | |
+++ b/TestFoundation/TestNSProgressFraction.swift | |
@@ -14,7 +14,7 @@ import XCTest | |
import SwiftFoundation | |
import SwiftXCTest | |
#endif | |
- | |
+/*** | |
class TestProgressFraction : XCTestCase { | |
static var allTests: [(String, (TestProgressFraction) -> () throws -> Void)] { | |
return [ | |
@@ -160,3 +160,4 @@ class TestProgressFraction : XCTestCase { | |
} | |
} | |
+****/ | |
diff --git a/TestFoundation/TestNSString.swift b/TestFoundation/TestNSString.swift | |
index 33177ca2..f6a48545 100644 | |
--- a/TestFoundation/TestNSString.swift | |
+++ b/TestFoundation/TestNSString.swift | |
@@ -35,7 +35,9 @@ internal let kCFStringEncodingUTF32BE = CFStringBuiltInEncodings.UTF32BE.rawVal | |
internal let kCFStringEncodingUTF32LE = CFStringBuiltInEncodings.UTF32LE.rawValue | |
#endif | |
- | |
+internal func testBundle() -> Bundle { | |
+ return Bundle.main | |
+} | |
class TestNSString : XCTestCase { | |
static var allTests: [(String, (TestNSString) -> () throws -> Void)] { | |
@@ -70,7 +72,7 @@ class TestNSString : XCTestCase { | |
("test_FromContentsOfURLUsedEncodingUTF16LE", test_FromContentsOfURLUsedEncodingUTF16LE), | |
("test_FromContentsOfURLUsedEncodingUTF32BE", test_FromContentsOfURLUsedEncodingUTF32BE), | |
("test_FromContentsOfURLUsedEncodingUTF32LE", test_FromContentsOfURLUsedEncodingUTF32LE), | |
- ("test_FromContentOfFile",test_FromContentOfFile), | |
+// ("test_FromContentOfFile",test_FromContentOfFile), | |
("test_swiftStringUTF16", test_swiftStringUTF16), | |
// This test takes forever on build servers; it has been seen up to 1852.084 seconds | |
// ("test_completePathIntoString", test_completePathIntoString), | |
@@ -265,21 +267,21 @@ class TestNSString : XCTestCase { | |
func test_FromNullTerminatedCStringInASCII() { | |
let bytes = mockASCIIStringBytes + [0x00] | |
- let string = NSString(CString: bytes.map { Int8(bitPattern: $0) }, encoding: String.Encoding.ascii.rawValue) | |
+ let string = NSString(cString: bytes.map { Int8(bitPattern: $0) }, encoding: String.Encoding.ascii.rawValue) | |
XCTAssertNotNil(string) | |
XCTAssertTrue(string?.isEqual(to: mockASCIIString) ?? false) | |
} | |
func test_FromNullTerminatedCStringInUTF8() { | |
let bytes = mockUTF8StringBytes + [0x00] | |
- let string = NSString(CString: bytes.map { Int8(bitPattern: $0) }, encoding: String.Encoding.utf8.rawValue) | |
+ let string = NSString(cString: bytes.map { Int8(bitPattern: $0) }, encoding: String.Encoding.utf8.rawValue) | |
XCTAssertNotNil(string) | |
XCTAssertTrue(string?.isEqual(to: mockUTF8String) ?? false) | |
} | |
func test_FromMalformedNullTerminatedCStringInUTF8() { | |
let bytes = mockMalformedUTF8StringBytes + [0x00] | |
- let string = NSString(CString: bytes.map { Int8(bitPattern: $0) }, encoding: String.Encoding.utf8.rawValue) | |
+ let string = NSString(cString: bytes.map { Int8(bitPattern: $0) }, encoding: String.Encoding.utf8.rawValue) | |
XCTAssertNil(string) | |
} | |
@@ -366,7 +368,7 @@ class TestNSString : XCTestCase { | |
XCTFail("Unable to init NSString from contentOf:usedEncoding:") | |
} | |
} | |
- | |
+/* | |
func test_FromContentOfFile() { | |
let testFilePath = testBundle().path(forResource: "NSStringTestData", ofType: "txt") | |
XCTAssertNotNil(testFilePath) | |
@@ -378,7 +380,7 @@ class TestNSString : XCTestCase { | |
XCTFail("Unable to init NSString from contentsOfFile:encoding:") | |
} | |
} | |
- | |
+*/ | |
func test_uppercaseString() { | |
XCTAssertEqual(NSString(stringLiteral: "abcd").uppercased, "ABCD") | |
XCTAssertEqual(NSString(stringLiteral: "abcd").uppercased, "ABCD") // full-width | |
diff --git a/TestFoundation/TestNSTextCheckingResult.swift b/TestFoundation/TestNSTextCheckingResult.swift | |
index f008fc2d..6be7f8c6 100644 | |
--- a/TestFoundation/TestNSTextCheckingResult.swift | |
+++ b/TestFoundation/TestNSTextCheckingResult.swift | |
@@ -34,17 +34,17 @@ class TestNSTextCheckingResult: XCTestCase { | |
let searchRange = NSMakeRange(0,7) | |
let match: NSTextCheckingResult = regex.firstMatch(in: searchString, options: searchOptions, range: searchRange)! | |
//Positive offset | |
- var result = match.resultByAdjustingRangesWithOffset(1) | |
+ var result = match.adjustingRanges(offset: 1) | |
XCTAssertEqual(result.range(at: 0).location, 6) | |
XCTAssertEqual(result.range(at: 1).location, NSNotFound) | |
XCTAssertEqual(result.range(at: 2).location, 6) | |
//Negative offset | |
- result = match.resultByAdjustingRangesWithOffset(-2) | |
+ result = match.adjustingRanges(offset: -2) | |
XCTAssertEqual(result.range(at: 0).location, 3) | |
XCTAssertEqual(result.range(at: 1).location, NSNotFound) | |
XCTAssertEqual(result.range(at: 2).location, 3) | |
//ZeroOffset | |
- result = match.resultByAdjustingRangesWithOffset(0) | |
+ result = match.adjustingRanges(offset: 0) | |
XCTAssertEqual(result.range(at: 0).location, 5) | |
XCTAssertEqual(result.range(at: 1).location, NSNotFound) | |
XCTAssertEqual(result.range(at: 2).location, 5) | |
diff --git a/TestFoundation/TestPropertyListSerialization.swift b/TestFoundation/TestPropertyListSerialization.swift | |
index 0f921b04..d50dc027 100644 | |
--- a/TestFoundation/TestPropertyListSerialization.swift | |
+++ b/TestFoundation/TestPropertyListSerialization.swift | |
@@ -22,8 +22,8 @@ class TestPropertyListSerialization : XCTestCase { | |
static var allTests: [(String, (TestPropertyListSerialization) -> () throws -> Void)] { | |
return [ | |
("test_BasicConstruction", test_BasicConstruction), | |
- ("test_decodeData", test_decodeData), | |
- ("test_decodeStream", test_decodeStream), | |
+ //("test_decodeData", test_decodeData), | |
+ // ("test_decodeStream", test_decodeStream), | |
] | |
} | |
@@ -39,7 +39,7 @@ class TestPropertyListSerialization : XCTestCase { | |
XCTAssertNotNil(data) | |
XCTAssertEqual(data!.count, 42, "empty dictionary should be 42 bytes") | |
} | |
- | |
+ /* | |
func test_decodeData() { | |
var decoded: Any? | |
var fmt = PropertyListSerialization.PropertyListFormat.binary | |
@@ -63,8 +63,8 @@ class TestPropertyListSerialization : XCTestCase { | |
} else { | |
XCTFail("value stored is not a string") | |
} | |
- } | |
- | |
+ }*/ | |
+/* | |
func test_decodeStream() { | |
var decoded: Any? | |
var fmt = PropertyListSerialization.PropertyListFormat.binary | |
@@ -89,5 +89,6 @@ class TestPropertyListSerialization : XCTestCase { | |
} else { | |
XCTFail("value stored is not a string") | |
} | |
- } | |
+ }*/ | |
} | |
+ | |
diff --git a/TestFoundation/TestScanner.swift b/TestFoundation/TestScanner.swift | |
index 2a1804ec..550dc74c 100644 | |
--- a/TestFoundation/TestScanner.swift | |
+++ b/TestFoundation/TestScanner.swift | |
@@ -25,7 +25,7 @@ class TestScanner : XCTestCase { | |
return [ | |
("test_scanInteger", test_scanInteger), | |
("test_scanFloat", test_scanFloat), | |
- ("test_scanString", test_scanString), | |
+ // ("test_scanString", test_scanString), | |
("test_charactersToBeSkipped", test_charactersToBeSkipped), | |
] | |
} | |
@@ -44,27 +44,27 @@ class TestScanner : XCTestCase { | |
XCTAssert(scanner.scanFloat(&value), "A Float should be found in the string `-350000000000000000000000000000000000000000`.") | |
XCTAssert(value.isInfinite, "Scanned Float value of the string `-350000000000000000000000000000000000000000` should be infinite`.") | |
} | |
- | |
+/** | |
func test_scanString() { | |
let scanner = Scanner(string: "apple sauce") | |
- guard let firstPart = scanner.scanString("apple ") else { | |
+ guard let firstPart = scanner.scanString("apple ", into: nil) else { | |
XCTFail() | |
return | |
} | |
- XCTAssertEqual(firstPart, "apple ") | |
+ XCTAssertEqual(firstPart, "apple ", into: nil) | |
XCTAssertFalse(scanner.isAtEnd) | |
- let _ = scanner.scanString("sauce") | |
+ let _ = scanner.scanString("sauce", into: nil) | |
XCTAssertTrue(scanner.isAtEnd) | |
} | |
- | |
+**/ | |
func test_charactersToBeSkipped() { | |
let scanner = Scanner(string: "xyz ") | |
scanner.charactersToBeSkipped = .whitespaces | |
- let _ = scanner.scanString("xyz") | |
+ let _ = scanner.scanString("xyz", into: nil) | |
XCTAssertTrue(scanner.isAtEnd) | |
} | |
} | |
diff --git a/TestFoundation/TestThread.swift b/TestFoundation/TestThread.swift | |
index 28478a4e..433c07da 100644 | |
--- a/TestFoundation/TestThread.swift | |
+++ b/TestFoundation/TestThread.swift | |
@@ -36,7 +36,7 @@ class TestThread : XCTestCase { | |
XCTAssertNotNil(thread1) | |
XCTAssertNotNil(thread2) | |
XCTAssertEqual(thread1, thread2) | |
- XCTAssertEqual(thread1, Thread.mainThread) | |
+ //XCTAssertEqual(thread1, Threadin) //Thread) | |
} | |
func test_threadStart() { | |
@@ -57,37 +57,22 @@ class TestThread : XCTestCase { | |
func test_threadName() { | |
let thread = Thread() | |
XCTAssertNil(thread.name) | |
- | |
- func getPThreadName() -> String? { | |
- var buf = [Int8](repeating: 0, count: 16) | |
- let r = _CFThreadGetName(&buf, Int32(buf.count)) | |
- | |
- guard r == 0 else { | |
- return nil | |
- } | |
- return String(cString: buf) | |
- } | |
- | |
let thread2 = Thread() { | |
Thread.current.name = "Thread2" | |
XCTAssertEqual(Thread.current.name, "Thread2") | |
- XCTAssertEqual(Thread.current.name, getPThreadName()) | |
} | |
thread2.start() | |
- | |
Thread.current.name = "CurrentThread" | |
- XCTAssertEqual(Thread.current.name, getPThreadName()) | |
let thread3 = Thread() | |
thread3.name = "Thread3" | |
XCTAssertEqual(thread3.name, "Thread3") | |
- XCTAssertNotEqual(thread3.name, getPThreadName()) | |
} | |
func test_mainThread() { | |
XCTAssertTrue(Thread.isMainThread) | |
- let t = Thread.mainThread | |
+ let t = Thread.main | |
XCTAssertTrue(t.isMainThread) | |
let c = Thread.current | |
XCTAssertTrue(c.isMainThread) | |
@@ -98,7 +83,7 @@ class TestThread : XCTestCase { | |
let thread = Thread() { | |
condition.lock() | |
XCTAssertFalse(Thread.isMainThread) | |
- XCTAssertFalse(Thread.mainThread == Thread.current) | |
+ XCTAssertFalse(Thread.main == Thread.current) | |
condition.broadcast() | |
condition.unlock() | |
} | |
@@ -122,3 +107,4 @@ class TestThread : XCTestCase { | |
XCTAssertTrue(addresses.count <= 128) | |
} | |
} | |
+ | |
diff --git a/TestFoundation/TestURL.swift b/TestFoundation/TestURL.swift | |
index 1ce0bf9e..57aeb7a6 100644 | |
--- a/TestFoundation/TestURL.swift | |
+++ b/TestFoundation/TestURL.swift | |
@@ -55,7 +55,7 @@ private func getTestData() -> [Any]? { | |
class TestURL : XCTestCase { | |
static var allTests: [(String, (TestURL) -> () throws -> Void)] { | |
return [ | |
- ("test_URLStrings", test_URLStrings), | |
+ //("test_URLStrings", test_URLStrings), | |
("test_fileURLWithPath_relativeTo", test_fileURLWithPath_relativeTo ), | |
// TODO: these tests fail on linux, more investigation is needed | |
("test_fileURLWithPath", test_fileURLWithPath), | |
@@ -193,7 +193,7 @@ class TestURL : XCTestCase { | |
return (true, []) | |
} | |
} | |
- | |
+/* | |
func test_URLStrings() { | |
for obj in getTestData()! { | |
let testDict = obj as! [String: Any] | |
@@ -228,7 +228,7 @@ class TestURL : XCTestCase { | |
} | |
} | |
- | |
+ */ | |
static let gBaseTemporaryDirectoryPath = NSTemporaryDirectory() | |
static var gBaseCurrentWorkingDirectoryPath : String { | |
let count = Int(1024) // MAXPATHLEN is platform specific; this is the lowest common denominator for darwin and most linuxes | |
@@ -425,7 +425,7 @@ class TestURL : XCTestCase { | |
} | |
} | |
- func test_reachable() { | |
+ func test_reachable() {/** | |
var url = URL(fileURLWithPath: "/usr") | |
XCTAssertEqual(true, try? url.checkResourceIsReachable()) | |
@@ -474,7 +474,7 @@ class TestURL : XCTestCase { | |
XCTAssertEqual(CocoaError.Code.fileReadNoSuchFile.rawValue, error.code) | |
} catch { | |
XCTFail() | |
- } | |
+ }**/ | |
} | |
func test_copy() { | |
@@ -504,14 +504,14 @@ class TestURL : XCTestCase { | |
class TestURLComponents : XCTestCase { | |
static var allTests: [(String, (TestURLComponents) -> () throws -> Void)] { | |
return [ | |
- ("test_string", test_string), | |
+ //("test_string", test_string), | |
("test_port", test_portSetter), | |
("test_url", test_url), | |
("test_copy", test_copy), | |
("test_createURLWithComponents", test_createURLWithComponents) | |
] | |
} | |
- | |
+ /* | |
func test_string() { | |
for obj in getTestData()! { | |
let testDict = obj as! [String: Any] | |
@@ -520,7 +520,7 @@ class TestURLComponents : XCTestCase { | |
guard let components = URLComponents(string: expectedString) else { continue } | |
XCTAssertEqual(components.string!, expectedString, "should be the expected string (\(components.string!) != \(expectedString))") | |
} | |
- } | |
+ }*/ | |
func test_portSetter() { | |
let urlString = "http://myhost.mydomain.com" | |
diff --git a/TestFoundation/TestUtils.swift b/TestFoundation/TestUtils.swift | |
index b587b36d..860e1291 100644 | |
--- a/TestFoundation/TestUtils.swift | |
+++ b/TestFoundation/TestUtils.swift | |
@@ -41,7 +41,7 @@ func ensureFiles(_ fileNames: [String]) -> Bool { | |
print(err) | |
return false | |
} | |
- } else if !isDir { | |
+ } else if !isDir.boolValue { | |
return false | |
} | |
diff --git a/TestFoundation/TestXMLDocument.swift b/TestFoundation/TestXMLDocument.swift | |
index d02ef9fa..e8a4c328 100644 | |
--- a/TestFoundation/TestXMLDocument.swift | |
+++ b/TestFoundation/TestXMLDocument.swift | |
@@ -38,9 +38,9 @@ class TestXMLDocument : XCTestCase { | |
("test_prefixes", test_prefixes), | |
// ("test_validation_success", test_validation_success), | |
// ("test_validation_failure", test_validation_failure), | |
- ("test_dtd", test_dtd), | |
- ("test_documentWithDTD", test_documentWithDTD), | |
- ("test_dtd_attributes", test_dtd_attributes), | |
+ // ("test_dtd", test_dtd), | |
+ // ("test_documentWithDTD", test_documentWithDTD), | |
+ //("test_dtd_attributes", test_dtd_attributes), | |
("test_documentWithEncodingSetDoesntCrash", test_documentWithEncodingSetDoesntCrash), | |
("test_nodeFindingWithNamespaces", test_nodeFindingWithNamespaces), | |
("test_createElement", test_createElement), | |
@@ -420,7 +420,7 @@ class TestXMLDocument : XCTestCase { | |
XCTAssert((error.userInfo[NSLocalizedDescriptionKey] as! String).contains("Element true was declared EMPTY this one has content")) | |
} | |
}*/ | |
- | |
+/* | |
func test_dtd() throws { | |
let node = XMLNode.dtdNode(withXMLString:"<!ELEMENT foo (#PCDATA)>") as! XMLDTDNode | |
XCTAssert(node.name == "foo") | |
@@ -458,8 +458,8 @@ class TestXMLDocument : XCTestCase { | |
elementDecl.stringValue = "(#PCDATA | array)*" | |
XCTAssert(elementDecl.stringValue == "(#PCDATA | array)*", elementDecl.stringValue ?? "nil string value") | |
XCTAssert(elementDecl.name == "MyElement") | |
- } | |
- | |
+ }*/ | |
+/* | |
func test_documentWithDTD() throws { | |
let doc = try XMLDocument(contentsOf: testBundle().url(forResource: "NSXMLDTDTestData", withExtension: "xml")!, options: []) | |
let dtd = doc.dtd | |
@@ -487,13 +487,13 @@ class TestXMLDocument : XCTestCase { | |
XCTFail("\(error)") | |
} | |
} | |
- | |
+ *//* | |
func test_dtd_attributes() throws { | |
let doc = try XMLDocument(contentsOf: testBundle().url(forResource: "NSXMLDTDTestData", withExtension: "xml")!, options: []) | |
let dtd = doc.dtd! | |
let attrDecl = dtd.attributeDeclaration(forName: "print", elementName: "foo")! | |
XCTAssert(attrDecl.dtdKind == .enumerationAttribute) | |
- } | |
+ }*/ | |
func test_documentWithEncodingSetDoesntCrash() throws { | |
weak var weakDoc: XMLDocument? = nil | |
diff --git a/TestFoundation/TestXMLParser.swift b/TestFoundation/TestXMLParser.swift | |
index b08f0b36..d1f6416b 100644 | |
--- a/TestFoundation/TestXMLParser.swift | |
+++ b/TestFoundation/TestXMLParser.swift | |
@@ -16,7 +16,7 @@ | |
import SwiftXCTest | |
#endif | |
-class OptionalParserConformance: XMLParserDelegate {} | |
+//class OptionalParserConformance: XMLParserDelegate {} | |
enum XMLParserDelegateEvent { | |
case startDocument | |
@@ -48,7 +48,7 @@ extension XMLParserDelegateEvent: Equatable { | |
} | |
} | |
- | |
+/** | |
class XMLParserDelegateEventStream: XMLParserDelegate { | |
var events: [XMLParserDelegateEvent] = [] | |
@@ -152,3 +152,4 @@ class TestXMLParser : XCTestCase { | |
} | |
} | |
+ ***/ | |
diff --git a/TestFoundation/main.swift b/TestFoundation/main.swift | |
index cefca938..b5775584 100644 | |
--- a/TestFoundation/main.swift | |
+++ b/TestFoundation/main.swift | |
@@ -92,13 +92,13 @@ XCTMain([ | |
testCase(TestNSUUID.allTests), | |
testCase(TestNSValue.allTests), | |
testCase(TestUserDefaults.allTests), | |
- testCase(TestXMLParser.allTests), | |
+ //testCase(TestXMLParser.allTests), | |
testCase(TestXMLDocument.allTests), | |
testCase(TestNSAttributedString.allTests), | |
testCase(TestNSMutableAttributedString.allTests), | |
testCase(TestFileHandle.allTests), | |
testCase(TestUnitConverter.allTests), | |
- testCase(TestProgressFraction.allTests), | |
+ //testCase(TestProgressFraction.allTests), | |
testCase(TestProgress.allTests), | |
testCase(TestObjCRuntime.allTests), | |
testCase(TestNotification.allTests), |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment