Sha256: 2b5294d43fa608a412d2d6a3c2d843fa1164524e680d86c6c216d62066da54e5

Contents?: true

Size: 927 Bytes

Versions: 3

Compression:

Stored size: 927 Bytes

Contents

#![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(tokio_wasi)))] // WASI does not support all fs operations

use tempfile::tempdir;
use tokio::fs;

#[tokio::test]
async fn remove_dir_all() {
    let temp_dir = tempdir().unwrap();

    let test_dir = temp_dir.path().join("test");
    fs::create_dir(&test_dir).await.unwrap();

    let file_path = test_dir.as_path().join("a.txt");

    fs::write(&file_path, b"Hello File!").await.unwrap();

    fs::remove_dir_all(test_dir.as_path()).await.unwrap();

    // test dir should no longer exist
    match fs::try_exists(test_dir).await {
        Ok(exists) => assert!(!exists),
        Err(_) => println!("ignored try_exists error after remove_dir_all"),
    };

    // contents should no longer exist
    match fs::try_exists(file_path).await {
        Ok(exists) => assert!(!exists),
        Err(_) => println!("ignored try_exists error after remove_dir_all"),
    };
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
wasmtime-9.0.1 ./ext/cargo-vendor/tokio-1.28.1/tests/fs_remove_dir_all.rs
wasmtime-8.0.0 ./ext/cargo-vendor/tokio-1.27.0/tests/fs_remove_dir_all.rs
wasmtime-7.0.0 ./ext/cargo-vendor/tokio-1.27.0/tests/fs_remove_dir_all.rs