test_nice.rs: remove unsafe (#12040)

This commit is contained in:
oech3
2026-04-28 05:08:39 +09:00
committed by GitHub
parent 843398fe62
commit 670fb243fd
+4 -6
View File
@@ -2,17 +2,15 @@
//
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.
// spell-checker:ignore libc's setpriority
// spell-checker:ignore getpriority setpriority
use uutests::new_ucmd;
#[test]
#[cfg(not(target_os = "android"))]
fn test_get_current_niceness() {
// Test that the nice command with no arguments returns the default nice
// value, which we determine by querying libc's `nice` in our own process.
new_ucmd!()
.succeeds()
.stdout_is(format!("{}\n", unsafe { libc::nice(0) }));
// Test that the nice command with no arguments returns the default nice value
let nice = rustix::process::getpriority_process(None).unwrap();
new_ucmd!().succeeds().stdout_is(format!("{nice}\n"));
}
#[test]