Repository: apple/swift-nio
File: Tests/NIOFSIntegrationTests/FileSystemTests.swift (Swift)

Code before:
            let home = getenv("HOME")
            XCTAssertTrue(home == nil || home!.pointee == 0, "Expected HOME to be unset or empty")

            #if os(Windows)
            let profile = getenv("USERPROFILE")
            XCTAssertTrue(profile == nil || profile!.pointee == 0, "Expected USERPROFILE to be unset or empty")
            #endif
        }
    }

    #if canImport(Darwin) || canImport(Glibc) || canImport(Musl) || canImport(Android)
    func testHomeDirectoryFromPasswd() {
        // Should always succeed on Unix-like systems for the current user
        let result = Libc.homeDirectoryFromPasswd()
        switch result {
        case .success(let path):
            XCTAssert(!path.isEmpty)
            XCTAssert(path.isAbsolute)
        case .failure(let errno):
            XCTFail("Expected success, got error: \(errno)")
        }
    }
    #endif

    func testInfo() async throws {
        let info = try await self.fs.info(forFileAt: .testDataReadme, infoAboutSymbolicLink: false)
        XCTAssertEqual(info?.type, .regular)
        XCTAssertGreaterThan(info?.size ?? -1, Int64(0))
    }

    func testInfoResolvingSymbolicLinks() async throws {
        let info = try await self.fs.info(
            forFileAt: .testDataReadmeSymlink,
            infoAboutSymbolicLink: false
        )
        XCTAssertEqual(info?.type, .regular)
        XCTAssertGreaterThan(info?.size ?? -1, Int64(0))
    }

    func testInfoWithoutResolvingSymbolicLinks() async throws {
        let info = try await self.fs.info(
            forFileAt: .testDataReadmeSymlink,
            infoAboutSymbolicLink: true
        )
        XCTAssertEqual(info?.type, .symlink)
        XCTAssertGreaterThan(info?.size ?? -1, Int64(0))
    }

    func testCreateSymbolicLink() async throws {
        let path = try await self.fs.temporaryFilePath()
        let destination = NIOFilePath.testDataReadme

Review comment (suggestion):
Nit: We don't need this (but only if we take the other nit suggestion)
```suggestion
```

Code after:
            let home = getenv("HOME")
            XCTAssertTrue(home == nil || home!.pointee == 0, "Expected HOME to be unset or empty")

            #if os(Windows)
            let profile = getenv("USERPROFILE")
            XCTAssertTrue(profile == nil || profile!.pointee == 0, "Expected USERPROFILE to be unset or empty")
            #endif
        }
    }

    #if canImport(Darwin) || canImport(Glibc) || canImport(Musl) || canImport(Android)
    func testHomeDirectoryFromPasswd() throws {
        #if targetEnvironment(simulator)
        // Simulators don't have a passwd database entry for the current user.
        throw XCTSkip("getpwuid_r has no passwd entry in simulator environments")
        #else
        // Should always succeed on Unix-like systems for the current user
        let result = Libc.homeDirectoryFromPasswd()
        switch result {
        case .success(let path):
            XCTAssert(!path.isEmpty)
            XCTAssert(path.isAbsolute)
        case .failure(let errno):
            XCTFail("Expected success, got error: \(errno)")
        }
        #endif
    }
    #endif

    func testInfo() async throws {
        let info = try await self.fs.info(forFileAt: .testDataReadme, infoAboutSymbolicLink: false)
        XCTAssertEqual(info?.type, .regular)
        XCTAssertGreaterThan(info?.size ?? -1, Int64(0))
    }

    func testInfoResolvingSymbolicLinks() async throws {
        let info = try await self.fs.info(
            forFileAt: .testDataReadmeSymlink,
            infoAboutSymbolicLink: false
        )
        XCTAssertEqual(info?.type, .regular)
        XCTAssertGreaterThan(info?.size ?? -1, Int64(0))
    }

    func testInfoWithoutResolvingSymbolicLinks() async throws {
        let info = try await self.fs.info(
            forFileAt: .testDataReadmeSymlink,
            infoAboutSymbolicLink: true
        )
        XCTAssertEqual(info?.type, .symlink)
        XCTAssertGreaterThan(info?.size ?? -1, Int64(0))