mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-09-15 19:36:16 +00:00
Merge pull request #4729 from spineki/b2sum-missing-l-option
B2sum: add -l/--length option
This commit is contained in:
commit
dd3c0f7fe9
3 changed files with 121 additions and 6 deletions
|
@ -125,6 +125,70 @@ fn test_check_sha1() {
|
|||
.stderr_is("");
|
||||
}
|
||||
|
||||
#[test]
|
||||
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;
|
||||
|
||||
at.write("testf", "foobar\n");
|
||||
at.write("testf.b2sum", "6a testf\n");
|
||||
|
||||
scene
|
||||
.ccmd("b2sum")
|
||||
.arg("--length=8")
|
||||
.arg("-c")
|
||||
.arg(at.subdir.join("testf.b2sum"))
|
||||
.succeeds()
|
||||
.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