mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-27 19:17:43 +00:00
tests: fix tests for CICD environment
This commit is contained in:
parent
d59cd4fc4a
commit
14b348dd4b
4 changed files with 16 additions and 6 deletions
|
@ -573,8 +573,7 @@ fn test_du_bytes() {
|
|||
#[cfg(all(
|
||||
not(target_vendor = "apple"),
|
||||
not(target_os = "windows"),
|
||||
not(target_os = "freebsd"),
|
||||
not(target_os = "linux")
|
||||
not(target_os = "freebsd")
|
||||
))]
|
||||
result.stdout_contains("21529\t./subdir\n");
|
||||
}
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
// * For the full copyright and license information, please view the LICENSE
|
||||
// * file that was distributed with this source code.
|
||||
|
||||
//spell-checker: ignore coreutil
|
||||
|
||||
use crate::common::util::*;
|
||||
|
||||
const VERSION_MIN_MULTIPLE_USERS: &str = "8.31"; // this feature was introduced in GNU's coreutils 8.31
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
// * For the full copyright and license information, please view the LICENSE
|
||||
// * file that was distributed with this source code.
|
||||
|
||||
#[cfg(unix)]
|
||||
use crate::common::util::*;
|
||||
|
||||
#[test]
|
||||
|
@ -39,7 +40,9 @@ fn test_normal_compare_env() {
|
|||
if whoami == "nobody" {
|
||||
println!("test skipped:");
|
||||
return;
|
||||
} else {
|
||||
} else if !is_ci() {
|
||||
new_ucmd!().succeeds().stdout_is(format!("{}\n", whoami));
|
||||
} else {
|
||||
println!("test skipped:");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
use pretty_assertions::assert_eq;
|
||||
#[cfg(target_os = "linux")]
|
||||
use rlimit::{prlimit, rlim};
|
||||
#[cfg(unix)]
|
||||
use std::borrow::Cow;
|
||||
use std::env;
|
||||
#[cfg(not(windows))]
|
||||
|
@ -1456,9 +1457,10 @@ mod tests {
|
|||
#[cfg(unix)]
|
||||
fn test_check_coreutil_version() {
|
||||
match check_coreutil_version("id", VERSION_MIN) {
|
||||
Ok(s) => s.starts_with("uutils-tests-"),
|
||||
Err(s) => s.starts_with("uutils-tests-warning"),
|
||||
Ok(s) => assert!(s.starts_with("uutils-tests-")),
|
||||
Err(s) => assert!(s.starts_with("uutils-tests-warning")),
|
||||
};
|
||||
#[cfg(target_os = "linux")]
|
||||
std::assert_eq!(
|
||||
check_coreutil_version("no test name", VERSION_MIN),
|
||||
Err("uutils-tests-warning: 'no test name' \
|
||||
|
@ -1471,7 +1473,11 @@ mod tests {
|
|||
#[cfg(unix)]
|
||||
fn test_expected_result() {
|
||||
let ts = TestScenario::new("id");
|
||||
assert!(expected_result(&ts, &[]).is_ok());
|
||||
// assert!(expected_result(&ts, &[]).is_ok());
|
||||
match expected_result(&ts, &[]) {
|
||||
Ok(r) => assert!(r.succeeded()),
|
||||
Err(s) => assert!(s.starts_with("uutils-tests-warning")),
|
||||
}
|
||||
let ts = TestScenario::new("no test name");
|
||||
assert!(expected_result(&ts, &[]).is_err());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue