mesg: Add tool

This commit is contained in:
Tuomas Tynkkynen
2025-03-01 22:38:19 +02:00
parent 758ce83267
commit c8aa5a6b57
8 changed files with 177 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
// This file is part of the uutils util-linux package.
//
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.
use crate::common::util::TestScenario;
#[test]
fn test_invalid_verb() {
new_ucmd!().arg("foo").fails().code_is(1);
}
#[test]
#[cfg(target_family = "unix")]
fn test_no_terminal() {
for args in &[vec![], vec!["y"], vec!["n"]] {
new_ucmd!()
.args(args)
.fails()
.code_is(2)
.stderr_contains("stdin/stdout/stderr is not a terminal");
}
}
#[cfg(not(target_family = "unix"))]
mod non_unix {
use crate::common::util::TestScenario;
#[test]
fn test_fails_on_unsupported_platforms() {
new_ucmd!()
.fails()
.code_is(1)
.stderr_is("mesg: `mesg` is available only on Unix platforms.\n");
}
}
+4
View File
@@ -17,6 +17,10 @@ mod test_lsmem;
#[path = "by-util/test_lslocks.rs"]
mod test_lslocks;
#[cfg(feature = "mesg")]
#[path = "by-util/test_mesg.rs"]
mod test_mesg;
#[cfg(feature = "mountpoint")]
#[path = "by-util/test_mountpoint.rs"]
mod test_mountpoint;