@@ -289,10 +289,11 @@ class TestFileHandle : XCTestCase {
289
289
" \( FileHandle . readCompletionNotification. rawValue) is not equal to NSFileHandleReadCompletionNotification " )
290
290
}
291
291
292
+ #if NS_FOUNDATION_ALLOWS_TESTABLE_IMPORT
292
293
func test_nullDevice( ) {
293
294
let fh = FileHandle . nullDevice
294
295
295
- XCTAssertEqual ( fh. fileDescriptor , - 1 )
296
+ XCTAssertFalse ( fh. _isPlatformHandleValid )
296
297
fh. closeFile ( )
297
298
fh. seek ( toFileOffset: 10 )
298
299
XCTAssertEqual ( fh. offsetInFile, 0 )
@@ -307,6 +308,7 @@ class TestFileHandle : XCTestCase {
307
308
fh. seek ( toFileOffset: 0 )
308
309
XCTAssertEqual ( fh. readDataToEndOfFile ( ) . count, 0 )
309
310
}
311
+ #endif
310
312
311
313
func test_truncateFile( ) {
312
314
let url : URL = URL ( fileURLWithPath: NSTemporaryDirectory ( ) ) . appendingPathComponent ( ProcessInfo . processInfo. globallyUniqueString, isDirectory: false )
@@ -502,7 +504,6 @@ class TestFileHandle : XCTestCase {
502
504
( " testWritingWithBuffer " , testWritingWithBuffer) ,
503
505
( " testWritingWithMultiregionData " , testWritingWithMultiregionData) ,
504
506
( " test_constants " , test_constants) ,
505
- ( " test_nullDevice " , test_nullDevice) ,
506
507
( " test_truncateFile " , test_truncateFile) ,
507
508
( " test_readabilityHandlerCloseFileRace " , test_readabilityHandlerCloseFileRace) ,
508
509
( " test_readabilityHandlerCloseFileRaceWithError " , test_readabilityHandlerCloseFileRaceWithError) ,
@@ -518,6 +519,7 @@ class TestFileHandle : XCTestCase {
518
519
#if NS_FOUNDATION_ALLOWS_TESTABLE_IMPORT
519
520
tests. append ( contentsOf: [
520
521
( " test_fileDescriptor " , test_fileDescriptor) ,
522
+ ( " test_nullDevice " , test_nullDevice) ,
521
523
( " testHandleCreationAndCleanup " , testHandleCreationAndCleanup) ,
522
524
( " testOffset " , testOffset) ,
523
525
] )
0 commit comments