|
7 | 7 | // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
8 | 8 | //
|
9 | 9 |
|
10 |
| -import CoreFoundation |
11 |
| - |
12 |
| -#if NS_FOUNDATION_ALLOWS_TESTABLE_IMPORT |
13 |
| - #if canImport(SwiftFoundation) && !DEPLOYMENT_RUNTIME_OBJC |
14 |
| - @testable import SwiftFoundation |
15 |
| - #else |
16 |
| - @testable import Foundation |
17 |
| - #endif |
18 |
| -#endif |
19 |
| - |
20 | 10 | class TestNSData: LoopbackServerTest {
|
21 | 11 |
|
22 | 12 | class AllOnesImmutableData : NSData {
|
@@ -233,8 +223,6 @@ class TestNSData: LoopbackServerTest {
|
233 | 223 | ("test_limitDebugDescription", test_limitDebugDescription),
|
234 | 224 | ("test_edgeDebugDescription", test_edgeDebugDescription),
|
235 | 225 | ("test_writeToURLOptions", test_writeToURLOptions),
|
236 |
| - ("test_writeToURLPermissions", test_writeToURLPermissions), |
237 |
| - ("test_writeToURLPermissionsWithAtomic", test_writeToURLPermissionsWithAtomic), |
238 | 226 | ("test_edgeNoCopyDescription", test_edgeNoCopyDescription),
|
239 | 227 | ("test_initializeWithBase64EncodedDataGetsDecodedData", test_initializeWithBase64EncodedDataGetsDecodedData),
|
240 | 228 | ("test_initializeWithBase64EncodedDataWithNonBase64CharacterIsNil", test_initializeWithBase64EncodedDataWithNonBase64CharacterIsNil),
|
@@ -563,51 +551,6 @@ class TestNSData: LoopbackServerTest {
|
563 | 551 | }
|
564 | 552 | }
|
565 | 553 |
|
566 |
| -#if !os(Windows) |
567 |
| - // NOTE: `umask(3)` is process global. Therefore, the behavior is unknown if `withUmask(_:_:)` is used simultaniously. |
568 |
| - private func withUmask(_ mode: mode_t, _ block: () -> Void) { |
569 |
| - let original = umask(mode) |
570 |
| - block() |
571 |
| - umask(original) |
572 |
| - } |
573 |
| -#endif |
574 |
| - |
575 |
| - func test_writeToURLPermissions() { |
576 |
| -#if NS_FOUNDATION_ALLOWS_TESTABLE_IMPORT && !os(Windows) |
577 |
| - withUmask(0) { |
578 |
| - do { |
579 |
| - let data = Data() |
580 |
| - let url = URL(fileURLWithPath: NSTemporaryDirectory() + "meow") |
581 |
| - try data.write(to: url) |
582 |
| - let fileManager = FileManager.default |
583 |
| - let permission = try fileManager._permissionsOfItem(atPath: url.path) |
584 |
| - XCTAssertEqual(0o666, permission) |
585 |
| - try! fileManager.removeItem(atPath: url.path) |
586 |
| - } catch { |
587 |
| - XCTFail() |
588 |
| - } |
589 |
| - } |
590 |
| -#endif |
591 |
| - } |
592 |
| - |
593 |
| - func test_writeToURLPermissionsWithAtomic() { |
594 |
| -#if NS_FOUNDATION_ALLOWS_TESTABLE_IMPORT && !os(Windows) |
595 |
| - withUmask(0) { |
596 |
| - do { |
597 |
| - let data = Data() |
598 |
| - let url = URL(fileURLWithPath: NSTemporaryDirectory() + "meow") |
599 |
| - try data.write(to: url, options: .atomic) |
600 |
| - let fileManager = FileManager.default |
601 |
| - let permission = try fileManager._permissionsOfItem(atPath: url.path) |
602 |
| - XCTAssertEqual(0o666, permission) |
603 |
| - try! fileManager.removeItem(atPath: url.path) |
604 |
| - } catch { |
605 |
| - XCTFail() |
606 |
| - } |
607 |
| - } |
608 |
| -#endif |
609 |
| - } |
610 |
| - |
611 | 554 | func test_emptyDescription() {
|
612 | 555 | let expected = "<>"
|
613 | 556 |
|
|
0 commit comments