1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-27 19:17:43 +00:00

tests: patch tests to simplify imports

This commit is contained in:
Dorian Peron 2025-07-01 01:52:57 +02:00
parent 5ce678b1cd
commit 6e23d4e979
63 changed files with 242 additions and 343 deletions

View file

@ -52,7 +52,7 @@ macro_rules! util_name {
#[macro_export]
macro_rules! new_ucmd {
() => {
TestScenario::new(util_name!()).ucmd()
::uutests::util::TestScenario::new(::uutests::util_name!()).ucmd()
};
}
@ -76,6 +76,22 @@ macro_rules! at_and_ucmd {
}};
}
/// Convenience macro for acquiring a [`TestScenario`] with its test path.
///
/// Returns a tuple containing the following:
/// - a [`TestScenario`] for invoking commands
/// - an [`AtPath`] that points to a unique temporary test directory
///
/// [`AtPath`]: crate::util::AtPath
/// [`TestScenario`]: crate::util::TestScenario
#[macro_export]
macro_rules! at_and_ts {
() => {{
let ts = ::uutests::util::TestScenario::new(::uutests::util_name!());
(ts.fixtures.clone(), ts)
}};
}
/// If `common::util::expected_result` returns an error, i.e. the `util` in `$PATH` doesn't
/// include a coreutils version string or the version is too low,
/// this macro can be used to automatically skip the test and print the reason.