Sha256: b4a6084d8a152a566f8cb240373400549f8515562e8a436fd642c001518ebf1f

Contents?: true

Size: 667 Bytes

Versions: 31

Compression:

Stored size: 667 Bytes

Contents

#[macro_use]
mod sys_common;

use std::fs::File;
use std::io::Read;
use system_interface::io::ReadReady;

#[test]
fn file_is_read_write() {
    let mut f = File::open("Cargo.toml").unwrap();

    let len = f.metadata().unwrap().len();
    assert_eq!(f.num_ready_bytes().unwrap(), len);

    let mut buf = [0u8; 6];
    f.read_exact(&mut buf).unwrap();
    assert_eq!(f.num_ready_bytes().unwrap(), len - (buf.len() as u64));

    #[cfg(target_os = "linux")]
    {
        let f = File::open("/dev/urandom").unwrap();
        let _ = f.num_ready_bytes().unwrap();

        let f = File::open("/dev/null").unwrap();
        let _ = f.num_ready_bytes().unwrap();
    }
}

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
wasmtime-29.0.0 ./ext/cargo-vendor/system-interface-0.27.3/tests/read_ready.rs
wasmtime-28.0.0 ./ext/cargo-vendor/system-interface-0.27.3/tests/read_ready.rs
wasmtime-27.0.0 ./ext/cargo-vendor/system-interface-0.27.2/tests/read_ready.rs
wasmtime-26.0.0 ./ext/cargo-vendor/system-interface-0.27.2/tests/read_ready.rs
wasmtime-25.0.2 ./ext/cargo-vendor/system-interface-0.27.2/tests/read_ready.rs
wasmtime-25.0.1 ./ext/cargo-vendor/system-interface-0.27.2/tests/read_ready.rs
wasmtime-25.0.0 ./ext/cargo-vendor/system-interface-0.27.2/tests/read_ready.rs
wasmtime-24.0.0 ./ext/cargo-vendor/system-interface-0.27.2/tests/read_ready.rs
wasmtime-23.0.2 ./ext/cargo-vendor/system-interface-0.27.2/tests/read_ready.rs
wasmtime-22.0.0 ./ext/cargo-vendor/system-interface-0.27.2/tests/read_ready.rs
wasmtime-21.0.1 ./ext/cargo-vendor/system-interface-0.27.2/tests/read_ready.rs
wasmtime-20.0.2 ./ext/cargo-vendor/system-interface-0.27.2/tests/read_ready.rs
wasmtime-20.0.0 ./ext/cargo-vendor/system-interface-0.27.2/tests/read_ready.rs
wasmtime-18.0.3 ./ext/cargo-vendor/system-interface-0.26.1/tests/read_ready.rs
wasmtime-17.0.1 ./ext/cargo-vendor/system-interface-0.26.1/tests/read_ready.rs
wasmtime-17.0.0 ./ext/cargo-vendor/system-interface-0.26.1/tests/read_ready.rs
wasmtime-16.0.0 ./ext/cargo-vendor/system-interface-0.26.1/tests/read_ready.rs
wasmtime-15.0.1 ./ext/cargo-vendor/system-interface-0.26.1/tests/read_ready.rs
wasmtime-15.0.0 ./ext/cargo-vendor/system-interface-0.26.1/tests/read_ready.rs
wasmtime-14.0.4 ./ext/cargo-vendor/system-interface-0.26.0/tests/read_ready.rs