forked from the-distro/ofborg
add basic test for nix operations
This commit is contained in:
parent
ca7f94b36b
commit
be82a649dd
1 changed files with 40 additions and 0 deletions
|
@ -299,6 +299,46 @@ mod tests {
|
|||
use std::path::PathBuf;
|
||||
use std::env;
|
||||
|
||||
#[test]
|
||||
fn test_build_operation() {
|
||||
let nix = nix();
|
||||
let op = Operation::Build;
|
||||
|
||||
assert_eq!(op.to_string(), "nix-build");
|
||||
|
||||
let ret: Result<File, File> =
|
||||
nix.run(
|
||||
nix.safe_command(op, build_path().as_path(), vec![String::from("--version")]),
|
||||
true,
|
||||
);
|
||||
|
||||
assert_run(
|
||||
ret,
|
||||
Expect::Pass,
|
||||
vec!["nix-build (Nix)"],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_instantiate_operation() {
|
||||
let nix = nix();
|
||||
let op = Operation::Instantiate;
|
||||
|
||||
assert_eq!(op.to_string(), "nix-instantiate");
|
||||
|
||||
let ret: Result<File, File> =
|
||||
nix.run(
|
||||
nix.safe_command(op, build_path().as_path(), vec![String::from("--version")]),
|
||||
true,
|
||||
);
|
||||
|
||||
assert_run(
|
||||
ret,
|
||||
Expect::Pass,
|
||||
vec!["nix-instantiate (Nix)"],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn safe_command_environment() {
|
||||
let nix = nix();
|
||||
|
|
Loading…
Reference in a new issue