2020-02-26 16:18:19 +00:00
|
|
|
use ansi_term::Color;
|
|
|
|
use std::io;
|
|
|
|
|
|
|
|
use crate::common;
|
|
|
|
|
2020-04-15 07:55:32 +00:00
|
|
|
#[test]
|
|
|
|
fn no_env_set() -> io::Result<()> {
|
|
|
|
let output = common::render_module("singularity").output()?;
|
|
|
|
let actual = String::from_utf8(output.stdout).unwrap();
|
|
|
|
|
|
|
|
let expected = "";
|
|
|
|
assert_eq!(expected, actual);
|
|
|
|
Ok(())
|
|
|
|
}
|
2020-02-26 16:18:19 +00:00
|
|
|
#[test]
|
|
|
|
fn env_set() -> io::Result<()> {
|
|
|
|
let output = common::render_module("singularity")
|
|
|
|
.env_clear()
|
|
|
|
.env("SINGULARITY_NAME", "centos.img")
|
|
|
|
.output()?;
|
|
|
|
|
|
|
|
let expected = format!("{} ", Color::Blue.bold().dimmed().paint("[centos.img]"));
|
|
|
|
let actual = String::from_utf8(output.stdout).unwrap();
|
|
|
|
|
|
|
|
assert_eq!(expected, actual);
|
|
|
|
Ok(())
|
|
|
|
}
|