Skip to content

Extract duplicated cleanup_test_files function to shared test utility module #156

Description

@coderabbitai

Summary

The cleanup_test_files function is duplicated across multiple test files in the file I/O test suite.

Affected Files

The same helper function appears in:

  • tests/file_io_execution_test.rs (lines 12-16)
  • tests/file_io_error_handling_test.rs (lines 12-16)
  • tests/file_io_performance_test.rs (lines 14-18)
  • tests/file_io_concurrent_test.rs (lines 13-17)

Proposed Solution

Extract the function to a shared test utilities module:

  1. Create tests/common.rs with a public cleanup_test_files(files: &[&str]) function
  2. Remove the local function from each test file
  3. Add module import (e.g., mod common; or #[path = "common.rs"] mod common;) to each test file
  4. Update calls to use common::cleanup_test_files(...)

Benefits

  • Reduces code duplication
  • Centralizes test utility functions
  • Makes maintenance easier

Backlinks

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