| |
Ok(())
|
| |
}
|
| |
|
| + |
/// A utility to check that some program can be executed with a `--version`
|
| + |
/// argument and exits successfully.
|
| + |
///
|
| + |
/// # Panics
|
| + |
///
|
| + |
/// If there is an error executing the program other than the program not being
|
| + |
/// found, or the program does not exit successfully.
|
| + |
fn program_reports_version(program: &str) -> bool {
|
| + |
use std::io::ErrorKind;
|
| + |
use std::process::{Command, Stdio};
|
| + |
|
| + |
match Command::new(program)
|
| + |
.arg("--version")
|
| + |
.stdout(Stdio::null())
|
| + |
.status()
|
| + |
{
|
| + |
Err(e) if e.kind() == ErrorKind::NotFound => {
|
| + |
log::warn!(target: "test", "`{program}` not found.");
|
| + |
false
|
| + |
}
|
| + |
Err(e) => panic!("failure to execute `{program}`: {e}"),
|
| + |
Ok(status) if status.success() => true,
|
| + |
Ok(status) => panic!("executing `{program}` resulted in status {status}"),
|
| + |
}
|
| + |
}
|
| + |
|
| |
#[test]
|
| |
fn rad_auth() {
|
| |
test("examples/rad-auth.md", Path::new("."), None, []).unwrap();
|
| |
|
| |
#[test]
|
| |
fn rad_cob_multiset() {
|
| - |
{
|
| - |
// `rad-cob-multiset` is a `jq` script, which requires `jq` to be installed.
|
| - |
// We test whether `jq` is installed, and have this test succeed if it is not.
|
| - |
// Programmatic skipping of tests is not supported as of 2024-08.
|
| - |
use std::io::ErrorKind;
|
| - |
use std::process::{Command, Stdio};
|
| - |
|
| - |
match Command::new("jq").arg("-V").stdout(Stdio::null()).status() {
|
| - |
Err(e) if e.kind() == ErrorKind::NotFound => {
|
| - |
log::warn!(target: "test", "`jq` not found. Succeeding prematurely.");
|
| - |
return;
|
| - |
}
|
| - |
Err(e) => panic!("while checking for jq: {e}"),
|
| - |
Ok(_) => {}
|
| - |
}
|
| + |
// `rad-cob-multiset` is a `jq` script, which requires `jq` to be installed.
|
| + |
// We test whether `jq` is installed, and have this test succeed if it is not.
|
| + |
// Programmatic skipping of tests is not supported as of 2024-08.
|
| + |
if !program_reports_version("jq") {
|
| + |
return;
|
| |
}
|
| |
|
| |
let mut environment = Environment::new();
|