diff options
author | John Letey <30328854+johnletey@users.noreply.github.com> | 2019-08-12 18:42:33 +0100 |
---|---|---|
committer | Matan Kushner <hello@matchai.me> | 2019-08-12 13:42:33 -0400 |
commit | 82cf484cedd0e989b39af760d6cc83b500454610 (patch) | |
tree | 7b76247043084608c947933ea0e7f1704a1a6b7d /tests/testsuite/jobs.rs | |
parent | 3f6fe50adb98ded2c7f90a581d2b8e1e88cde7e2 (diff) |
feat: Implement the prompt module for jobs (#85)
Diffstat (limited to 'tests/testsuite/jobs.rs')
-rw-r--r-- | tests/testsuite/jobs.rs | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/tests/testsuite/jobs.rs b/tests/testsuite/jobs.rs new file mode 100644 index 000000000..885684abb --- /dev/null +++ b/tests/testsuite/jobs.rs @@ -0,0 +1,85 @@ +use ansi_term::Color; +use std::fs; +use std::io; +use std::path::Path; +use tempfile::TempDir; + +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(()) +} |