2023-08-21 08:49:27 +00:00
|
|
|
// This file is part of the uutils coreutils package.
|
|
|
|
//
|
|
|
|
// For the full copyright and license information, please view the LICENSE
|
|
|
|
// file that was distributed with this source code.
|
2023-03-20 13:51:19 +00:00
|
|
|
use crate::common::util::{is_ci, TestScenario};
|
2020-06-07 15:41:48 +00:00
|
|
|
use std::env;
|
|
|
|
|
2022-09-10 16:38:14 +00:00
|
|
|
#[test]
|
|
|
|
fn test_invalid_arg() {
|
|
|
|
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
|
|
|
}
|
|
|
|
|
2020-06-07 15:41:48 +00:00
|
|
|
#[test]
|
|
|
|
fn test_normal() {
|
2021-04-05 20:03:43 +00:00
|
|
|
let result = new_ucmd!().run();
|
2020-06-07 15:41:48 +00:00
|
|
|
println!("env::var(CI).is_ok() = {}", env::var("CI").is_ok());
|
|
|
|
|
|
|
|
for (key, value) in env::vars() {
|
2023-01-27 09:29:45 +00:00
|
|
|
println!("{key}: {value}");
|
2020-06-07 15:41:48 +00:00
|
|
|
}
|
2021-05-25 23:45:53 +00:00
|
|
|
if (is_ci() || uucore::os::is_wsl_1()) && result.stderr_str().contains("no login name") {
|
2020-06-14 16:51:20 +00:00
|
|
|
// ToDO: investigate WSL failure
|
2020-06-07 15:41:48 +00:00
|
|
|
// In the CI, some server are failing to return logname.
|
|
|
|
// As seems to be a configuration issue, ignoring it
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-04-05 20:03:43 +00:00
|
|
|
result.success();
|
|
|
|
assert!(!result.stdout_str().trim().is_empty());
|
2020-06-07 15:41:48 +00:00
|
|
|
}
|