Skip to content

Implement Windows-specific readonly file handling in file I/O error tests #151

Description

@coderabbitai

Description

The Windows-specific code block in the readonly file test is currently empty, which means the test doesn't properly validate readonly file behavior on Windows platforms.

Location

  • File: tests/file_io_error_handling_test.rs
  • Lines: 124-126
  • Test: test_write_to_readonly_file_error

Problem

The current implementation has an empty #[cfg(windows)] block, so the readonly file test only works on Unix systems. Windows requires different API calls to set file attributes as read-only.

Expected Implementation

The Windows branch should:

  1. Create and write initial content to the test file
  2. Set the FILE_ATTRIBUTE_READONLY flag using Windows API (SetFileAttributesW or helper crate)
  3. Run the same readonly behavior assertions as the Unix path
  4. Clear the read-only attribute before cleanup to ensure successful file deletion

References

Requested by

@logbie

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions