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

Code before:
        // Should return a value when HOME is set (which it typically is)
        if let path = Libc.homeDirectoryFromEnvironment() {
            XCTAssert(!path.isEmpty)
            XCTAssert(path.isAbsolute)

            // Verify it matches the high-level API
            let fsHome = try await self.fs.homeDirectory
            XCTAssertEqual(path, fsHome.underlying)
        } else {
            // If it returns nil, then HOME check should fail
            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(

Review comment (suggestion):
Nit: This can just be `#endif`

```suggestion
        #endif
```

Code after:
        // Should return a value when HOME is set (which it typically is)
        if let path = Libc.homeDirectoryFromEnvironment() {
            XCTAssert(!path.isEmpty)
            XCTAssert(path.isAbsolute)

            // Verify it matches the high-level API
            let fsHome = try await self.fs.homeDirectory
            XCTAssertEqual(path, fsHome.underlying)
        } else {
            // If it returns nil, then HOME check should fail
            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)