mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
stat/uucore: refactor - move fsext.rs to uucore
This commit is contained in:
parent
d43af35147
commit
203ee463c7
7 changed files with 47 additions and 41 deletions
|
@ -5,33 +5,6 @@ use crate::common::util::*;
|
|||
extern crate stat;
|
||||
pub use self::stat::*;
|
||||
|
||||
#[cfg(test)]
|
||||
mod test_fsext {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_file_type() {
|
||||
assert_eq!("block special file", pretty_filetype(S_IFBLK, 0));
|
||||
assert_eq!("character special file", pretty_filetype(S_IFCHR, 0));
|
||||
assert_eq!("regular file", pretty_filetype(S_IFREG, 1));
|
||||
assert_eq!("regular empty file", pretty_filetype(S_IFREG, 0));
|
||||
assert_eq!("weird file", pretty_filetype(0, 0));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_fs_type() {
|
||||
assert_eq!("ext2/ext3", pretty_fstype(0xEF53));
|
||||
assert_eq!("tmpfs", pretty_fstype(0x01021994));
|
||||
assert_eq!("nfs", pretty_fstype(0x6969));
|
||||
assert_eq!("btrfs", pretty_fstype(0x9123683e));
|
||||
assert_eq!("xfs", pretty_fstype(0x58465342));
|
||||
assert_eq!("zfs", pretty_fstype(0x2FC12FC1));
|
||||
assert_eq!("ntfs", pretty_fstype(0x5346544e));
|
||||
assert_eq!("fat", pretty_fstype(0x4006));
|
||||
assert_eq!("UNKNOWN (0x1234)", pretty_fstype(0x1234));
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_scanutil() {
|
||||
assert_eq!(Some((-5, 2)), "-5zxc".scan_num::<i32>());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue