File tree Expand file tree Collapse file tree 3 files changed +14
-18
lines changed Expand file tree Collapse file tree 3 files changed +14
-18
lines changed Original file line number Diff line number Diff line change @@ -53,25 +53,24 @@ enum _XCTThrowableBlockResult {
53
53
/// and if it does consume the exception and return information about it.
54
54
func _XCTRunThrowableBlock( _ block: ( ) throws -> Void ) -> _XCTThrowableBlockResult {
55
55
var blockErrorOptional : Error ?
56
-
57
- let d = _XCTRunThrowableBlockBridge ( {
56
+
57
+ let exceptionResult = _XCTRunThrowableBlockBridge ( {
58
58
do {
59
59
try block ( )
60
60
} catch {
61
61
blockErrorOptional = error
62
62
}
63
63
} )
64
-
64
+
65
65
if let blockError = blockErrorOptional {
66
66
return . failedWithError( error: blockError)
67
- } else if d. count > 0 {
68
- let t : String = d [ " type " ] !
69
-
70
- if t == " objc " {
67
+ } else if let exceptionResult = exceptionResult {
68
+
69
+ if exceptionResult [ " type " ] == " objc " {
71
70
return . failedWithException(
72
- className: d [ " className " ] !,
73
- name: d [ " name " ] !,
74
- reason: d [ " reason " ] !)
71
+ className: exceptionResult [ " className " ] !,
72
+ name: exceptionResult [ " name " ] !,
73
+ reason: exceptionResult [ " reason " ] !)
75
74
} else {
76
75
return . failedWithUnknownException
77
76
}
Original file line number Diff line number Diff line change @@ -133,17 +133,15 @@ - (NSString *)className
133
133
//
134
134
// If no exception is thrown by the block, returns an empty dictionary.
135
135
136
- XCT_EXPORT NSDictionary *_XCTRunThrowableBlockBridge (void (^block)());
136
+ XCT_EXPORT NSDictionary < NSString *, NSString *> *_XCTRunThrowableBlockBridge (void (^block)());
137
137
138
- NSDictionary *_XCTRunThrowableBlockBridge (void (^block)())
138
+ NSDictionary < NSString *, NSString *> *_XCTRunThrowableBlockBridge (void (^block)())
139
139
{
140
- NSDictionary * result;
140
+ NSDictionary < NSString *, NSString *> * result = nil ;
141
141
142
142
@try {
143
143
block ();
144
- result = @{};
145
144
}
146
-
147
145
@catch (NSException *exception) {
148
146
result = @{
149
147
@" type" : @" objc" ,
@@ -152,12 +150,11 @@ - (NSString *)className
152
150
@" reason" : exception.reason ,
153
151
};
154
152
}
155
-
156
153
@catch (...) {
157
154
result = @{
158
155
@" type" : @" unknown" ,
159
156
};
160
157
}
161
158
162
- return [ result retain ] ;
159
+ return result;
163
160
}
Original file line number Diff line number Diff line change 19
19
20
20
XCTestCase * _Nonnull _XCTCurrentTestCase (void );
21
21
22
- NSDictionary<NSString *, NSString *> * _Nonnull
22
+ NSDictionary<NSString *, NSString *> * _Nullable
23
23
_XCTRunThrowableBlockBridge (void (^ _Nonnull NS_NOESCAPE block)());
24
24
25
25
#endif // SWIFT_STDLIB_SHIMS_XCTEST_OVERLAY_H
You can’t perform that action at this time.
0 commit comments