 // See http://swift.org/LICENSE.txt for license information
 // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
 //
+
+import CoreFoundation
+
+#if NS_FOUNDATION_ALLOWS_TESTABLE_IMPORT
+    #if canImport(SwiftFoundation) && !DEPLOYMENT_RUNTIME_OBJC
+        @testable import SwiftFoundation
+    #else
+        @testable import Foundation
+    #endif
+#endif
 
 class TestNSData: LoopbackServerTest {
     

            ("test_limitDebugDescription", test_limitDebugDescription),
            ("test_edgeDebugDescription", test_edgeDebugDescription),
            ("test_writeToURLOptions", test_writeToURLOptions),
            ("test_edgeNoCopyDescription", test_edgeNoCopyDescription),
            ("test_initializeWithBase64EncodedDataGetsDecodedData", test_initializeWithBase64EncodedDataGetsDecodedData),
            ("test_initializeWithBase64EncodedDataWithNonBase64CharacterIsNil", test_initializeWithBase64EncodedDataWithNonBase64CharacterIsNil),

        }
    }

#if !os(Windows)
    // NOTE: `umask(3)` is process global. Therefore, the behavior is unknown if `withUmask(_:_:)` is used simultaniously.
    private func withUmask(_ mode: mode_t, _ block: () -> Void) {
        let original = umask(mode)
        block()
        umask(original)
    }
#endif

    func test_writeToURLPermissions() {
#if NS_FOUNDATION_ALLOWS_TESTABLE_IMPORT && !os(Windows)
        withUmask(0) {
            do {
                let data = Data()
                let url = URL(fileURLWithPath: NSTemporaryDirectory() + "meow")
                try data.write(to: url)
                let fileManager = FileManager.default
                let permission = try fileManager._permissionsOfItem(atPath: url.path)
                XCTAssertEqual(0o666, permission)
                try! fileManager.removeItem(atPath: url.path)
            } catch {
                XCTFail()
            }
        }
#endif
    }

    func test_writeToURLPermissionsWithAtomic() {
#if NS_FOUNDATION_ALLOWS_TESTABLE_IMPORT && !os(Windows)
        withUmask(0) {
            do {
                let data = Data()
                let url = URL(fileURLWithPath: NSTemporaryDirectory() + "meow")
                try data.write(to: url, options: .atomic)
                let fileManager = FileManager.default
                let permission = try fileManager._permissionsOfItem(atPath: url.path)
                XCTAssertEqual(0o666, permission)
                try! fileManager.removeItem(atPath: url.path)
            } catch {
                XCTFail()
            }
        }
#endif
    }

    func test_emptyDescription() {
        let expected = "<>"
        
