From ade142843c8bd153d488055bd808ea36bfbb2fe7 Mon Sep 17 00:00:00 2001 From: Szymon Walter Date: Mon, 19 Mar 2018 17:42:08 +0100 Subject: [PATCH] add `file_len` test and rewrite `file` test --- src/fs.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/fs.rs b/src/fs.rs index f802ded..1090b41 100644 --- a/src/fs.rs +++ b/src/fs.rs @@ -33,12 +33,20 @@ mod tests { use std::fs::File; use std::cell::RefCell; + use buffer::Buffer; + use super::Ext2; + #[test] + fn file_len() { + let file = RefCell::new(File::open("ext2.bin").unwrap()); + assert_eq!(unsafe { file.slice_unchecked(1024..2048).len() }, 1024); + } + #[test] fn file() { let file = RefCell::new(File::open("ext2.bin").unwrap()); let mut fs = Ext2::new(file); - assert!(fs.init().is_ok()); + assert_eq!(Ok(()), fs.init()); } }