1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

Merge pull request #2662 from Smicry/master

add kill -l final new line #2644
This commit is contained in:
Sylvestre Ledru 2021-09-29 09:58:50 +02:00 committed by GitHub
commit 01d098993b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 8 deletions

View file

@ -158,18 +158,13 @@ fn print_signal(signal_name_or_value: &str) -> UResult<()> {
}
fn print_signals() {
let mut pos = 0;
for (idx, signal) in ALL_SIGNALS.iter().enumerate() {
pos += signal.len();
print!("{}", signal);
if idx > 0 && pos > 73 {
println!();
pos = 0;
} else {
pos += 1;
if idx > 0 {
print!(" ");
}
print!("{}", signal);
}
println!();
}
fn list(arg: Option<String>) -> UResult<()> {

View file

@ -56,6 +56,12 @@ fn test_kill_list_all_signals() {
.stdout_contains("HUP");
}
#[test]
fn test_kill_list_final_new_line() {
let re = Regex::new("\\n$").unwrap();
assert!(re.is_match(new_ucmd!().arg("-l").succeeds().stdout_str()));
}
#[test]
fn test_kill_list_all_signals_as_table() {
// Check for a few signals. Do not try to be comprehensive.