Skip to content

Commit

Permalink
one new test case and deleted duplicate show cksum: stops when one of…
Browse files Browse the repository at this point in the history
… given files doesn't exist uutils#5809
  • Loading branch information
biplab5464 committed Jan 14, 2024
1 parent 2dda0b3 commit 2ff4920
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/uu/cksum/src/cksum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ use std::fs::File;
use std::io::{self, stdin, stdout, BufReader, Read, Write};
use std::iter;
use std::path::Path;
use uucore::show;
use uucore::{
error::{FromIo, UError, UResult, USimpleError},
format_usage, help_about, help_section, help_usage, show,
Expand Down
17 changes: 17 additions & 0 deletions tests/by-util/test_cksum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,3 +349,20 @@ fn test_folder_and_file() {
.stderr_contains(format!("cksum: {folder_name}: Is a directory"))
.stdout_is_fixture("crc_single_file.expected");
}

#[test]
fn test_one_nonexisting_file(){
let (at, mut ucmd) = at_and_ucmd!();

at.touch("abc.txt");
at.touch("xyz.txt");

ucmd
.arg("abc.txt")
.arg("asdf.txt")
.arg("xyz.txt")
.fails()
.stdout_contains_line("4294967295 0 xyz.txt")
.stderr_contains("asdf.txt: No such file or directory")
.stdout_contains_line("4294967295 0 abc.txt");
}

0 comments on commit 2ff4920

Please sign in to comment.