Added read+write test for `ManagedFD` & `MemoryFile`.

Fortune for mapped-file's current commit: Curse − 凶
master
Avril 2 years ago
parent 71da5e610f
commit d74946934d
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -2,7 +2,7 @@
name = "mapped-file"
description = "Construct a memory mapping over any file object"
keywords = ["unix", "mmap", "generic", "file", "fd"]
version = "0.0.5"
version = "0.0.6"
edition = "2021"
repository="https://github.com/notflan/mapped-file"
license="MIT"

@ -39,4 +39,13 @@ mod tests
test_fileno::<STDOUT_FILENO>("STDOUT_FILENO", std::io::stdout().as_raw_fd());
test_fileno::<STDERR_FILENO>("STDERR_FILENO", std::io::stderr().as_raw_fd());
}
#[test]
fn test_readwrite()
{
let mut input = ManagedFD::from(memory::MemoryFile::new().unwrap());
let mut output = memory::MemoryFile::new().unwrap();
assert_eq!(std::io::copy(&mut input, &mut output).unwrap(), 0, "Bad read");
}
}

Loading…
Cancel
Save