Skip to content

Commit

Permalink
cksum: add failing tests - to be fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
sylvestre committed May 14, 2024
1 parent 115b203 commit 58c2b5d
Showing 1 changed file with 56 additions and 3 deletions.
59 changes: 56 additions & 3 deletions tests/by-util/test_cksum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -920,7 +920,9 @@ fn test_cksum_check_failed() {
.arg("CHECKSUM")
.fails();

assert!(result.stderr_str().contains("input: No such file or directory"));
assert!(result
.stderr_str()
.contains("input: No such file or directory"));
assert!(result
.stderr_str()
.contains("2 lines are improperly formatted\n"));
Expand All @@ -932,7 +934,9 @@ fn test_cksum_check_failed() {
// without strict
let result = scene.ucmd().arg("--check").arg("CHECKSUM").fails();

assert!(result.stderr_str().contains("input: No such file or directory"));
assert!(result
.stderr_str()
.contains("input: No such file or directory"));
assert!(result
.stderr_str()
.contains("2 lines are improperly formatted\n"));
Expand Down Expand Up @@ -960,7 +964,9 @@ fn test_cksum_check_failed() {
.fails();
println!("result.stderr_str() {}", result.stderr_str());
println!("result.stdout_str() {}", result.stdout_str());
assert!(result.stderr_str().contains("input2: No such file or directory"));
assert!(result
.stderr_str()
.contains("input2: No such file or directory"));
assert!(result
.stderr_str()
.contains("4 lines are improperly formatted\n"));
Expand Down Expand Up @@ -1064,3 +1070,50 @@ fn test_cksum_garbage() {
.fails()
.stderr_contains("check-file: no properly formatted checksum lines found");
}

#[ignore = "Should fail on bits"]
#[test]
fn test_md5_bits() {
let (at, mut ucmd) = at_and_ucmd!();
at.write(

Check warning on line 1078 in tests/by-util/test_cksum.rs

View check run for this annotation

Codecov / codecov/patch

tests/by-util/test_cksum.rs#L1076-L1078

Added lines #L1076 - L1078 were not covered by tests
"f",
"MD5-65536 (README.md) = e5773576fc75ff0f8eba14f61587ae28\n",
);

ucmd.arg("-c")

Check warning on line 1083 in tests/by-util/test_cksum.rs

View check run for this annotation

Codecov / codecov/patch

tests/by-util/test_cksum.rs#L1083

Added line #L1083 was not covered by tests
.arg("f")
.fails()
.stderr_contains("f: no properly formatted checksum lines found");
}

Check warning on line 1087 in tests/by-util/test_cksum.rs

View check run for this annotation

Codecov / codecov/patch

tests/by-util/test_cksum.rs#L1086-L1087

Added lines #L1086 - L1087 were not covered by tests

#[ignore = "Should fail on bits"]
#[test]
fn test_blake2b_bits() {
let (at, mut ucmd) = at_and_ucmd!();
at.write(

Check warning on line 1093 in tests/by-util/test_cksum.rs

View check run for this annotation

Codecov / codecov/patch

tests/by-util/test_cksum.rs#L1091-L1093

Added lines #L1091 - L1093 were not covered by tests
"f",
"BLAKE2b-257 (README.md) = f9a984b70cf9a7549920864860fd1131c9fb6c0552def0b6dcce1d87b4ec4c5d\n"
);

ucmd.arg("-c")

Check warning on line 1098 in tests/by-util/test_cksum.rs

View check run for this annotation

Codecov / codecov/patch

tests/by-util/test_cksum.rs#L1098

Added line #L1098 was not covered by tests
.arg("f")
.fails()
.stderr_contains("f: no properly formatted checksum lines found");
}

Check warning on line 1102 in tests/by-util/test_cksum.rs

View check run for this annotation

Codecov / codecov/patch

tests/by-util/test_cksum.rs#L1101-L1102

Added lines #L1101 - L1102 were not covered by tests

#[ignore = "Different output"]
#[test]
fn test_blake2d_tested_with_sha1() {
let (at, mut ucmd) = at_and_ucmd!();
at.write(

Check warning on line 1108 in tests/by-util/test_cksum.rs

View check run for this annotation

Codecov / codecov/patch

tests/by-util/test_cksum.rs#L1106-L1108

Added lines #L1106 - L1108 were not covered by tests
"f",
"BLAKE2b (f) = 786a02f742015903c6c6fd852552d272912f4740e15847618a86e217f71f5419d25e1031afee585313896444934eb04b903a685b1448b755d56f701afe9be2ce\n"
);

ucmd.arg("-a")

Check warning on line 1113 in tests/by-util/test_cksum.rs

View check run for this annotation

Codecov / codecov/patch

tests/by-util/test_cksum.rs#L1113

Added line #L1113 was not covered by tests
.arg("sha1")
.arg("-c")
.arg("f")
.fails()
.stderr_contains("f: no properly formatted checksum lines found");
}

Check warning on line 1119 in tests/by-util/test_cksum.rs

View check run for this annotation

Codecov / codecov/patch

tests/by-util/test_cksum.rs#L1118-L1119

Added lines #L1118 - L1119 were not covered by tests

0 comments on commit 58c2b5d

Please sign in to comment.