Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Library doesn't work if one directory is empty and the second is not #34

Open
AJIOB opened this issue Feb 9, 2024 · 0 comments
Open

Comments

@AJIOB
Copy link

AJIOB commented Feb 9, 2024

Code:

#[tokio::test]
async fn only_one_empty_dir() {
    let temp_dir1 = Temp::new_dir().expect("Failed to create temp dir 1");
    let temp_dir2 = Temp::new_dir().expect("Failed to create temp dir 2");

    let temp_file1 = temp_dir1.join("file1");
    fs::write(temp_file1, "")
        .await
        .expect("Failed to write to temp file 1");

    assert!(
        dir_diff::is_different(temp_dir1, temp_dir2).expect("Failed to compare dirs"),
        "One dir has empty file and other not"
    );
}

Test dependencies:

  • tokio with fs & macro features (for file creation asynchronously & async test run) - std::fs may be used for this
  • mktemp for temp dirs creation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant