summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzwPapEr <zw.paper@gmail.com>2019-12-12 12:28:50 +0800
committerAbin Simon <abinsimon10@gmail.com>2020-01-11 14:17:44 +0530
commitd9b68ccd10c13f5d08ed2d9444aabe4b3ad7607e (patch)
tree02981ec87ed629973ecde2faa8b20a079e1dfa82
parent37a97353a1a7035d2a2f7de888bd7c97849a4a9d (diff)
test: :hammer: fix test after delete default, add inode windows test
-rw-r--r--src/meta/inode.rs2
-rw-r--r--tests/integration.rs30
2 files changed, 24 insertions, 8 deletions
diff --git a/src/meta/inode.rs b/src/meta/inode.rs
index 930830c..2d9e52b 100644
--- a/src/meta/inode.rs
+++ b/src/meta/inode.rs
@@ -15,7 +15,7 @@ impl<'a> From<&'a Metadata> for INode {
let index = meta.ino();
Self {
- index: index,
+ index,
valide: true,
}
}
diff --git a/tests/integration.rs b/tests/integration.rs
index 96ac61e..c934f26 100644
--- a/tests/integration.rs
+++ b/tests/integration.rs
@@ -21,32 +21,34 @@ fn test_list_empty_directory() {
#[test]
fn test_list_almost_all_empty_directory() {
+ let matched = "";
cmd()
.arg("--almost-all")
.arg(tempdir().path())
.assert()
- .stdout(predicate::eq(""));
+ .stdout(predicate::eq(matched));
cmd()
.arg("-A")
.arg(tempdir().path())
.assert()
- .stdout(predicate::eq(""));
+ .stdout(predicate::eq(matched));
}
#[test]
fn test_list_all_empty_directory() {
+ let matched = "\\.\n\\.\\.\n$";
cmd()
.arg("--all")
.arg(tempdir().path())
.assert()
- .stdout(predicate::str::is_match(".* \\.\n.* \\.\\.\n$").unwrap());
+ .stdout(predicate::str::is_match(matched).unwrap());
cmd()
.arg("-a")
.arg(tempdir().path())
.assert()
- .stdout(predicate::str::is_match(".* \\.\n.* \\.\\.\n$").unwrap());
+ .stdout(predicate::str::is_match(matched).unwrap());
}
#[test]
@@ -57,7 +59,7 @@ fn test_list_populated_directory() {
cmd()
.arg(dir.path())
.assert()
- .stdout(predicate::str::is_match(".* one\n.* two\n$").unwrap());
+ .stdout(predicate::str::is_match("one\ntwo\n$").unwrap());
}
#[test]
@@ -69,7 +71,7 @@ fn test_list_almost_all_populated_directory() {
.arg("--almost-all")
.arg(dir.path())
.assert()
- .stdout(predicate::str::is_match(".* one\n.* two\n$").unwrap());
+ .stdout(predicate::str::is_match("one\ntwo\n$").unwrap());
}
#[test]
@@ -81,7 +83,7 @@ fn test_list_all_populated_directory() {
.arg("--all")
.arg(dir.path())
.assert()
- .stdout(predicate::str::is_match(".* \\.\n.* \\.\\.\n.* one\n.* two\n$").unwrap());
+ .stdout(predicate::str::is_match("\\.\n\\.\\.\none\ntwo\n$").unwrap());
}
#[test]
@@ -98,6 +100,20 @@ fn test_list_inode_populated_directory() {
.stdout(predicate::str::is_match("\\d+ one\n\\d+ two\n$").unwrap());
}
+#[test]
+#[cfg(windows)]
+fn test_list_inode_populated_directory() {
+ let dir = tempdir();
+ dir.child("one").touch().unwrap();
+ dir.child("two").touch().unwrap();
+ cmd()
+ .arg("--blocks")
+ .arg("inode,name")
+ .arg(dir.path())
+ .assert()
+ .stdout(predicate::str::is_match("- one\n\\- two\n$").unwrap());
+}
+
fn cmd() -> Command {
Command::cargo_bin(env!("CARGO_PKG_NAME")).unwrap()
}