Sha256: eae02a644078164bab7bd1c1a5a2ebc85f90adb110c955eb4bf01a34e9321aac

Contents?: true

Size: 1.46 KB

Versions: 30

Compression:

Stored size: 1.46 KB

Contents

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

use tokio::fs::OpenOptions;
use windows_sys::Win32::Storage::FileSystem;

#[tokio::test]
#[cfg(windows)]
async fn open_options_windows_access_mode() {
    // TESTING HACK: use Debug output to check the stored data
    assert!(format!("{:?}", OpenOptions::new().access_mode(0)).contains("access_mode: Some(0)"));
}

#[tokio::test]
#[cfg(windows)]
async fn open_options_windows_share_mode() {
    // TESTING HACK: use Debug output to check the stored data
    assert!(format!("{:?}", OpenOptions::new().share_mode(0)).contains("share_mode: 0,"));
}

#[tokio::test]
#[cfg(windows)]
async fn open_options_windows_custom_flags() {
    // TESTING HACK: use Debug output to check the stored data
    assert!(format!(
        "{:?}",
        OpenOptions::new().custom_flags(FileSystem::FILE_FLAG_DELETE_ON_CLOSE)
    )
    .contains("custom_flags: 67108864,"));
}

#[tokio::test]
#[cfg(windows)]
async fn open_options_windows_attributes() {
    assert!(format!(
        "{:?}",
        OpenOptions::new().attributes(FileSystem::FILE_ATTRIBUTE_HIDDEN)
    )
    .contains("attributes: 2,"));
}

#[tokio::test]
#[cfg(windows)]
async fn open_options_windows_security_qos_flags() {
    assert!(format!(
        "{:?}",
        OpenOptions::new().security_qos_flags(FileSystem::SECURITY_IDENTIFICATION)
    )
    .contains("security_qos_flags: 1114112,"));
}

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
wasmtime-29.0.0 ./ext/cargo-vendor/tokio-1.43.0/tests/fs_open_options_windows.rs
wasmtime-28.0.0 ./ext/cargo-vendor/tokio-1.43.0/tests/fs_open_options_windows.rs
wasmtime-27.0.0 ./ext/cargo-vendor/tokio-1.41.1/tests/fs_open_options_windows.rs
wasmtime-26.0.0 ./ext/cargo-vendor/tokio-1.41.0/tests/fs_open_options_windows.rs
wasmtime-25.0.2 ./ext/cargo-vendor/tokio-1.40.0/tests/fs_open_options_windows.rs
wasmtime-25.0.1 ./ext/cargo-vendor/tokio-1.39.3/tests/fs_open_options_windows.rs
wasmtime-25.0.0 ./ext/cargo-vendor/tokio-1.39.3/tests/fs_open_options_windows.rs
wasmtime-24.0.0 ./ext/cargo-vendor/tokio-1.39.3/tests/fs_open_options_windows.rs
wasmtime-23.0.2 ./ext/cargo-vendor/tokio-1.36.0/tests/fs_open_options_windows.rs
wasmtime-22.0.0 ./ext/cargo-vendor/tokio-1.36.0/tests/fs_open_options_windows.rs
wasmtime-21.0.1 ./ext/cargo-vendor/tokio-1.36.0/tests/fs_open_options_windows.rs
wasmtime-20.0.2 ./ext/cargo-vendor/tokio-1.36.0/tests/fs_open_options_windows.rs
wasmtime-20.0.0 ./ext/cargo-vendor/tokio-1.36.0/tests/fs_open_options_windows.rs
wasmtime-18.0.3 ./ext/cargo-vendor/tokio-1.36.0/tests/fs_open_options_windows.rs
wasmtime-17.0.1 ./ext/cargo-vendor/tokio-1.35.1/tests/fs_open_options_windows.rs
wasmtime-17.0.0 ./ext/cargo-vendor/tokio-1.35.1/tests/fs_open_options_windows.rs
wasmtime-16.0.0 ./ext/cargo-vendor/tokio-1.35.1/tests/fs_open_options_windows.rs
wasmtime-15.0.1 ./ext/cargo-vendor/tokio-1.35.1/tests/fs_open_options_windows.rs
wasmtime-15.0.0 ./ext/cargo-vendor/tokio-1.35.1/tests/fs_open_options_windows.rs
wasmtime-14.0.4 ./ext/cargo-vendor/tokio-1.33.0/tests/fs_open_options_windows.rs