@@ -29,10 +29,9 @@ class TestNSBundle : XCTestCase {
29
29
( " test_localizations " , test_localizations) ,
30
30
( " test_URLsForResourcesWithExtension " , test_URLsForResourcesWithExtension) ,
31
31
( " test_bundleLoad " , test_bundleLoad) ,
32
- ( " test_bundleLoadWithError " , test_bundleLoadWithError) ,
33
- ( " test_bundleWithInvalidPath " , test_bundleWithInvalidPath) ,
34
- ( " test_bundlePreflight " , test_bundlePreflight) ,
35
-
32
+ ( " test_bundleLoadWithError " , test_bundleLoadWithError) ,
33
+ ( " test_bundleWithInvalidPath " , test_bundleWithInvalidPath) ,
34
+ ( " test_bundlePreflight " , test_bundlePreflight) ,
36
35
]
37
36
}
38
37
@@ -165,7 +164,7 @@ class TestNSBundle : XCTestCase {
165
164
}
166
165
167
166
func test_bundleLoadWithError( ) {
168
- let bundleValid = NSBundle . mainBundle ( )
167
+ let bundleValid = Bundle . main ( )
169
168
//test valid load using loadAndReturnError
170
169
do {
171
170
try bundleValid. loadAndReturnError ( )
@@ -174,26 +173,26 @@ class TestNSBundle : XCTestCase {
174
173
}
175
174
// executable cannot be located
176
175
guard let playground = _setupPlayground ( ) else { XCTFail ( " Unable to create playground " ) ; return }
177
- let bundle = NSBundle ( path: playground + _bundleName)
176
+ let bundle = Bundle ( path: playground + _bundleName)
178
177
XCTAssertThrowsError ( try bundle!. loadAndReturnError ( ) )
179
178
_cleanupPlayground ( playground)
180
179
}
181
180
182
181
func test_bundleWithInvalidPath( ) {
183
- let bundleInvalid = NSBundle ( path: " /tmp/test.playground " )
182
+ let bundleInvalid = Bundle ( path: " /tmp/test.playground " )
184
183
XCTAssertNil ( bundleInvalid)
185
184
}
186
185
187
186
func test_bundlePreflight( ) {
188
- let bundleValid = NSBundle . mainBundle ( )
187
+ let bundleValid = Bundle . main ( )
189
188
do {
190
189
try bundleValid. preflight ( )
191
190
} catch {
192
191
XCTFail ( " should not fail to load " )
193
192
}
194
193
// executable cannot be located ..preflight should report error
195
194
guard let playground = _setupPlayground ( ) else { XCTFail ( " Unable to create playground " ) ; return }
196
- let bundle = NSBundle ( path: playground + _bundleName)
195
+ let bundle = Bundle ( path: playground + _bundleName)
197
196
XCTAssertThrowsError ( try bundle!. preflight ( ) )
198
197
_cleanupPlayground ( playground)
199
198
}
0 commit comments