1
0
mirror of https://github.com/Llewellynvdm/starship.git synced 2024-09-09 05:39:01 +00:00
starship/tests/testsuite/jobs.rs
Matan Kushner e66d7bae1c
ci: Migrate CI from Azure Pipelines to GitHub Actions (#233)
Migrated CI from Azure Pipelines to GitHub Actions.
Until the release process is figured out in Actions, we'll stick to using Azure pipelines for releases.
2019-09-04 19:13:53 -04:00

83 lines
2.1 KiB
Rust

use ansi_term::Color;
use std::io;
use crate::common::{self, TestCommand};
#[test]
fn config_blank_job_0() -> io::Result<()> {
let output = common::render_module("jobs").arg("--jobs=0").output()?;
let actual = String::from_utf8(output.stdout).unwrap();
let expected = "";
assert_eq!(expected, actual);
Ok(())
}
#[test]
fn config_blank_job_1() -> io::Result<()> {
let output = common::render_module("jobs").arg("--jobs=1").output()?;
let actual = String::from_utf8(output.stdout).unwrap();
let expected = format!("{} ", Color::Blue.bold().paint(""));
assert_eq!(expected, actual);
Ok(())
}
#[test]
fn config_blank_job_2() -> io::Result<()> {
let output = common::render_module("jobs").arg("--jobs=2").output()?;
let actual = String::from_utf8(output.stdout).unwrap();
let expected = format!("{} ", Color::Blue.bold().paint("✦2"));
assert_eq!(expected, actual);
Ok(())
}
#[test]
fn config_2_job_2() -> io::Result<()> {
let output = common::render_module("jobs")
.use_config(toml::toml! {
[jobs]
threshold = 2
})
.arg("--jobs=2")
.output()?;
let actual = String::from_utf8(output.stdout).unwrap();
let expected = format!("{} ", Color::Blue.bold().paint(""));
assert_eq!(expected, actual);
Ok(())
}
#[test]
fn config_2_job_3() -> io::Result<()> {
let output = common::render_module("jobs")
.use_config(toml::toml! {
[jobs]
threshold = 2
})
.arg("--jobs=3")
.output()?;
let actual = String::from_utf8(output.stdout).unwrap();
let expected = format!("{} ", Color::Blue.bold().paint("✦3"));
assert_eq!(expected, actual);
Ok(())
}
#[test]
fn config_disabled() -> io::Result<()> {
let output = common::render_module("jobs")
.use_config(toml::toml! {
[jobs]
disabled = true
})
.arg("--jobs=1")
.output()?;
let actual = String::from_utf8(output.stdout).unwrap();
let expected = "";
assert_eq!(expected, actual);
Ok(())
}