mirror of
https://github.com/lsd-rs/lsd
synced 2024-12-13 13:42:34 +00:00
test: add inode args integration test
This commit is contained in:
parent
11d10caf0f
commit
74660f1d70
1 changed files with 21 additions and 7 deletions
|
@ -87,31 +87,45 @@ fn test_list_all_populated_directory() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(unix)]
|
|
||||||
fn test_list_inode_populated_directory() {
|
fn test_list_inode_populated_directory() {
|
||||||
let dir = tempdir();
|
let dir = tempdir();
|
||||||
dir.child("one").touch().unwrap();
|
dir.child("one").touch().unwrap();
|
||||||
dir.child("two").touch().unwrap();
|
dir.child("two").touch().unwrap();
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
|
let matched = "\\d+ one\n\\d+ two\n$";
|
||||||
|
#[cfg(windows)]
|
||||||
|
let matched = "- one\n\\- two\n$";
|
||||||
|
|
||||||
cmd()
|
cmd()
|
||||||
.arg("--blocks")
|
.arg("--inode")
|
||||||
.arg("inode,name")
|
|
||||||
.arg(dir.path())
|
.arg(dir.path())
|
||||||
.assert()
|
.assert()
|
||||||
.stdout(predicate::str::is_match("\\d+ one\n\\d+ two\n$").unwrap());
|
.stdout(predicate::str::is_match(matched).unwrap());
|
||||||
|
cmd()
|
||||||
|
.arg("-i")
|
||||||
|
.arg(dir.path())
|
||||||
|
.assert()
|
||||||
|
.stdout(predicate::str::is_match(matched).unwrap());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(windows)]
|
fn test_list_block_inode_populated_directory() {
|
||||||
fn test_list_inode_populated_directory() {
|
|
||||||
let dir = tempdir();
|
let dir = tempdir();
|
||||||
dir.child("one").touch().unwrap();
|
dir.child("one").touch().unwrap();
|
||||||
dir.child("two").touch().unwrap();
|
dir.child("two").touch().unwrap();
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
|
let matched = "\\d+ one\n\\d+ two\n$";
|
||||||
|
#[cfg(windows)]
|
||||||
|
let matched = "- one\n\\- two\n$";
|
||||||
|
|
||||||
cmd()
|
cmd()
|
||||||
.arg("--blocks")
|
.arg("--blocks")
|
||||||
.arg("inode,name")
|
.arg("inode,name")
|
||||||
.arg(dir.path())
|
.arg(dir.path())
|
||||||
.assert()
|
.assert()
|
||||||
.stdout(predicate::str::is_match("- one\n\\- two\n$").unwrap());
|
.stdout(predicate::str::is_match(matched).unwrap());
|
||||||
}
|
}
|
||||||
|
|
||||||
fn cmd() -> Command {
|
fn cmd() -> Command {
|
||||||
|
|
Loading…
Reference in a new issue