add file_len
test and rewrite file
test
This commit is contained in:
parent
2e336270c8
commit
ade142843c
10
src/fs.rs
10
src/fs.rs
|
@ -33,12 +33,20 @@ mod tests {
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
|
|
||||||
|
use buffer::Buffer;
|
||||||
|
|
||||||
use super::Ext2;
|
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]
|
#[test]
|
||||||
fn file() {
|
fn file() {
|
||||||
let file = RefCell::new(File::open("ext2.bin").unwrap());
|
let file = RefCell::new(File::open("ext2.bin").unwrap());
|
||||||
let mut fs = Ext2::new(file);
|
let mut fs = Ext2::new(file);
|
||||||
assert!(fs.init().is_ok());
|
assert_eq!(Ok(()), fs.init());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue