Sha256: 463ada6fbd6455070eec5d84684d76dbe9a245c82698b6e2264674ea0343cc5e

Contents?: true

Size: 935 Bytes

Versions: 30

Compression:

Stored size: 935 Bytes

Contents

#![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "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

30 entries across 30 versions & 1 rubygems

Version Path
wasmtime-14.0.3 ./ext/cargo-vendor/tokio-1.33.0/tests/fs_remove_dir_all.rs
wasmtime-14.0.1 ./ext/cargo-vendor/tokio-1.33.0/tests/fs_remove_dir_all.rs
wasmtime-14.0.0 ./ext/cargo-vendor/tokio-1.33.0/tests/fs_remove_dir_all.rs
wasmtime-13.0.0 ./ext/cargo-vendor/tokio-1.32.0/tests/fs_remove_dir_all.rs
wasmtime-12.0.1 ./ext/cargo-vendor/tokio-1.32.0/tests/fs_remove_dir_all.rs
wasmtime-12.0.0 ./ext/cargo-vendor/tokio-1.32.0/tests/fs_remove_dir_all.rs
wasmtime-11.0.0 ./ext/cargo-vendor/tokio-1.32.0/tests/fs_remove_dir_all.rs
wasmtime-10.0.1 ./ext/cargo-vendor/tokio-1.30.0/tests/fs_remove_dir_all.rs
wasmtime-10.0.0 ./ext/cargo-vendor/tokio-1.30.0/tests/fs_remove_dir_all.rs
wasmtime-9.0.4 ./ext/cargo-vendor/tokio-1.30.0/tests/fs_remove_dir_all.rs