mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-27 11:07:44 +00:00
b2sum: added tests to handle 0, non multiple of 8 and and more than 512 cases
This commit is contained in:
parent
fdbebfad9d
commit
756293a9c4
1 changed files with 48 additions and 1 deletions
|
@ -126,7 +126,24 @@ fn test_check_sha1() {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn test_check_b2sum_length_option() {
|
||||
fn test_check_b2sum_length_option_0() {
|
||||
let scene = TestScenario::new(util_name!());
|
||||
let at = &scene.fixtures;
|
||||
|
||||
at.write("testf", "foobar\n");
|
||||
at.write("testf.b2sum", "9e2bf63e933e610efee4a8d6cd4a9387e80860edee97e27db3b37a828d226ab1eb92a9cdd8ca9ca67a753edaf8bd89a0558496f67a30af6f766943839acf0110 testf\n");
|
||||
|
||||
scene
|
||||
.ccmd("b2sum")
|
||||
.arg("--length=0")
|
||||
.arg("-c")
|
||||
.arg(at.subdir.join("testf.b2sum"))
|
||||
.succeeds()
|
||||
.stdout_only("testf: OK\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_check_b2sum_length_option_8() {
|
||||
let scene = TestScenario::new(util_name!());
|
||||
let at = &scene.fixtures;
|
||||
|
||||
|
@ -142,6 +159,36 @@ fn test_check_b2sum_length_option() {
|
|||
.stdout_only("testf: OK\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_invalid_b2sum_length_option_not_multiple_of_8() {
|
||||
let scene = TestScenario::new(util_name!());
|
||||
let at = &scene.fixtures;
|
||||
|
||||
at.write("testf", "foobar\n");
|
||||
|
||||
scene
|
||||
.ccmd("b2sum")
|
||||
.arg("--length=9")
|
||||
.arg(at.subdir.join("testf"))
|
||||
.fails()
|
||||
.code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_invalid_b2sum_length_option_too_large() {
|
||||
let scene = TestScenario::new(util_name!());
|
||||
let at = &scene.fixtures;
|
||||
|
||||
at.write("testf", "foobar\n");
|
||||
|
||||
scene
|
||||
.ccmd("b2sum")
|
||||
.arg("--length=513")
|
||||
.arg(at.subdir.join("testf"))
|
||||
.fails()
|
||||
.code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_check_file_not_found_warning() {
|
||||
let scene = TestScenario::new(util_name!());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue