Skip to content

Commit b99f354

Browse files
authored
Merge pull request #147 from CodaFi/some-type-of-wei
Update for SE-0096
2 parents 43291d7 + 9a8da95 commit b99f354

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

Sources/XCTest/Private/TestListing.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ protocol Listable {
5252
}
5353

5454
private func moduleName(value: Any) -> String {
55-
let moduleAndType = String(reflecting: value.dynamicType)
55+
let moduleAndType = String(reflecting: type(of: value))
5656
return String(moduleAndType.characters.split(separator: ".").first!)
5757
}
5858

@@ -63,7 +63,7 @@ extension XCTestSuite: Listable {
6363
}
6464

6565
private var listingName: String {
66-
if let childTestCase = tests.first as? XCTestCase, name == String(describing: childTestCase.dynamicType) {
66+
if let childTestCase = tests.first as? XCTestCase, name == String(describing: type(of: childTestCase)) {
6767
return "\(moduleName(value: childTestCase)).\(name)"
6868
} else {
6969
return name

Sources/XCTest/Private/WallClockTimeMetric.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ internal final class WallClockTimeMetric: PerformanceMetric {
4444
String(format: "average: %.3f", measurements.average),
4545
String(format: "relative standard deviation: %.3f%%", measurements.relativeStandardDeviation),
4646
"values: [\(measurements.map({ String(format: "%.6f", $0) }).joined(separator: ", "))]",
47-
"performanceMetricID:\(self.dynamicType.name)",
47+
"performanceMetricID:\(type(of: self).name)",
4848
String(format: "maxPercentRelativeStandardDeviation: %.3f%%", maxRelativeStandardDeviation),
4949
String(format: "maxStandardDeviation: %.3f", standardDeviationNegligibilityThreshold),
5050
]

Sources/XCTest/Public/XCTestCase+Performance.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public extension XCTestCase {
5050
/// ensure compatibility of tests between swift-corelibs-xctest and Apple
5151
/// XCTest, it is not recommended to pass explicit values for `file` and `line`.
5252
func measure(file: StaticString = #file, line: UInt = #line, block: () -> Void) {
53-
measureMetrics(self.dynamicType.defaultPerformanceMetrics(),
53+
measureMetrics(type(of: self).defaultPerformanceMetrics(),
5454
automaticallyStartMeasuring: true,
5555
file: file,
5656
line: line,
@@ -66,7 +66,7 @@ public extension XCTestCase {
6666
/// may interfere the API will measure them separately.
6767
///
6868
/// func testMyFunction2_WallClockTime() {
69-
/// measureMetrics(self.dynamicType.defaultPerformanceMetrics(), automaticallyStartMeasuring: false) {
69+
/// measureMetrics(type(of: self).defaultPerformanceMetrics(), automaticallyStartMeasuring: false) {
7070
///
7171
/// // Do setup work that needs to be done for every iteration but
7272
/// // you don't want to measure before the call to `startMeasuring()`

Sources/XCTest/Public/XCTestCase.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public class XCTestCase: XCTest {
9090
/// `-[XCTestCase initWithInvocation:]`, it's rare for anyone outside of
9191
/// XCTest itself to call this initializer.
9292
public required init(name: String, testClosure: @escaping (XCTestCase) throws -> Void) {
93-
_name = "\(self.dynamicType).\(name)"
93+
_name = "\(type(of: self)).\(name)"
9494
self.testClosure = testClosure
9595
}
9696

@@ -179,7 +179,7 @@ public func testCase<T: XCTestCase>(_ allTests: [(String, (T) -> () -> Void)]) -
179179
private func test<T: XCTestCase>(_ testFunc: @escaping (T) -> () throws -> Void) -> (XCTestCase) throws -> Void {
180180
return { testCaseType in
181181
guard let testCase = testCaseType as? T else {
182-
fatalError("Attempt to invoke test on class \(T.self) with incompatible instance type \(testCaseType.dynamicType)")
182+
fatalError("Attempt to invoke test on class \(T.self) with incompatible instance type \(type(of: testCaseType))")
183183
}
184184

185185
try testFunc(testCase)()

0 commit comments

Comments
 (0)