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

kill: ignore signal case on -s

This commit is contained in:
Haisham 2024-04-14 23:13:17 +05:00 committed by Ben Wiederhake
parent 524be6e4ae
commit b617876372
2 changed files with 36 additions and 1 deletions

View file

@ -236,6 +236,17 @@ fn test_kill_with_signal_name_new_form() {
assert_eq!(target.wait_for_signal(), Some(libc::SIGKILL));
}
#[test]
fn test_kill_with_signal_name_new_form_ignore_case() {
let mut target = Target::new();
new_ucmd!()
.arg("-s")
.arg("KiLl")
.arg(format!("{}", target.pid()))
.succeeds();
assert_eq!(target.wait_for_signal(), Some(libc::SIGKILL));
}
#[test]
fn test_kill_with_signal_prefixed_name_new_form() {
let mut target = Target::new();
@ -247,6 +258,29 @@ fn test_kill_with_signal_prefixed_name_new_form() {
assert_eq!(target.wait_for_signal(), Some(libc::SIGKILL));
}
#[test]
fn test_kill_with_signal_prefixed_name_new_form_ignore_case() {
let mut target = Target::new();
new_ucmd!()
.arg("-s")
.arg("SiGKiLl")
.arg(format!("{}", target.pid()))
.succeeds();
assert_eq!(target.wait_for_signal(), Some(libc::SIGKILL));
}
#[test]
fn test_kill_with_signal_name_new_form_unknown_must_match_input_case() {
let target = Target::new();
new_ucmd!()
.arg("-s")
.arg("IaMnOtAsIgNaL") // spell-checker:disable-line
.arg(format!("{}", target.pid()))
.fails()
.stderr_contains("unknown signal")
.stderr_contains("IaMnOtAsIgNaL"); // spell-checker:disable-line
}
#[test]
fn test_kill_no_pid_provided() {
// spell-checker:disable-line