cli/tests: Refactor checkout command tests
This commit is contained in:
parent
5aaf978f97
commit
7a1e6a2423
|
|
@ -30,6 +30,10 @@ mod util;
|
||||||
use util::environment::{config, Environment};
|
use util::environment::{config, Environment};
|
||||||
use util::formula::formula;
|
use util::formula::formula;
|
||||||
|
|
||||||
|
mod commands {
|
||||||
|
mod checkout;
|
||||||
|
}
|
||||||
|
|
||||||
/// Run a CLI test file.
|
/// Run a CLI test file.
|
||||||
pub(crate) fn test<'a>(
|
pub(crate) fn test<'a>(
|
||||||
test: impl AsRef<Path>,
|
test: impl AsRef<Path>,
|
||||||
|
|
@ -357,42 +361,6 @@ fn rad_warn_old_nodes() {
|
||||||
Environment::alice(["rad-warn-old-nodes"]);
|
Environment::alice(["rad-warn-old-nodes"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn rad_checkout() {
|
|
||||||
let mut environment = Environment::new();
|
|
||||||
let profile = environment.profile("alice");
|
|
||||||
let copy = tempfile::tempdir().unwrap();
|
|
||||||
|
|
||||||
environment.repository(&profile);
|
|
||||||
|
|
||||||
environment.test("rad-init", &profile).unwrap();
|
|
||||||
test(
|
|
||||||
"examples/rad-checkout.md",
|
|
||||||
copy.path(),
|
|
||||||
Some(&profile.home),
|
|
||||||
[],
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
if cfg!(target_os = "linux") {
|
|
||||||
test(
|
|
||||||
"examples/rad-checkout-repo-config-linux.md",
|
|
||||||
copy.path(),
|
|
||||||
Some(&profile.home),
|
|
||||||
[],
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
} else if cfg!(target_os = "macos") {
|
|
||||||
test(
|
|
||||||
"examples/rad-checkout-repo-config-macos.md",
|
|
||||||
copy.path(),
|
|
||||||
Some(&profile.home),
|
|
||||||
[],
|
|
||||||
)
|
|
||||||
.unwrap();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn rad_id() {
|
fn rad_id() {
|
||||||
let mut environment = Environment::new();
|
let mut environment = Environment::new();
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,38 @@
|
||||||
|
use crate::test;
|
||||||
|
use crate::util::environment::Environment;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn rad_checkout() {
|
||||||
|
let mut environment = Environment::new();
|
||||||
|
let profile = environment.profile("alice");
|
||||||
|
let copy = tempfile::tempdir().unwrap();
|
||||||
|
|
||||||
|
environment.repository(&profile);
|
||||||
|
|
||||||
|
environment.test("rad-init", &profile).unwrap();
|
||||||
|
test(
|
||||||
|
"examples/rad-checkout.md",
|
||||||
|
copy.path(),
|
||||||
|
Some(&profile.home),
|
||||||
|
[],
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
if cfg!(target_os = "linux") {
|
||||||
|
test(
|
||||||
|
"examples/rad-checkout-repo-config-linux.md",
|
||||||
|
copy.path(),
|
||||||
|
Some(&profile.home),
|
||||||
|
[],
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
} else if cfg!(target_os = "macos") {
|
||||||
|
test(
|
||||||
|
"examples/rad-checkout-repo-config-macos.md",
|
||||||
|
copy.path(),
|
||||||
|
Some(&profile.home),
|
||||||
|
[],
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue