2024-11-29 20:03:32 +01:00
|
|
|
use treehouse::vfs::{entries, query, BufferedFile, Content, VPath};
|
2024-11-08 14:52:32 +01:00
|
|
|
|
|
|
|
fn vfs() -> BufferedFile {
|
2025-01-14 23:09:01 +01:00
|
|
|
BufferedFile::new(Content::new("text/plain", b"hewwo :3".to_vec()))
|
2024-11-08 14:52:32 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn dir() {
|
|
|
|
let vfs = vfs();
|
2024-11-29 20:03:32 +01:00
|
|
|
assert!(entries(&vfs, VPath::ROOT).is_empty());
|
2024-11-08 14:52:32 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn content() {
|
|
|
|
let vfs = vfs();
|
|
|
|
assert_eq!(
|
2024-11-29 20:03:32 +01:00
|
|
|
query::<Content>(&vfs, VPath::ROOT)
|
|
|
|
.map(|c| c.bytes())
|
|
|
|
.as_deref(),
|
2024-11-08 14:52:32 +01:00
|
|
|
Some(b"hewwo :3".as_slice()),
|
|
|
|
);
|
|
|
|
}
|