From 2882b78de55c08af80093fc58ff92f476bcb4360 Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Fri, 11 Nov 2016 18:46:04 -0800 Subject: [PATCH] Don't ignore `--color=never` (#56) Fixes a bug where `--color=never` was ignored. --- src/app.rs | 2 +- src/integration.rs | 32 +++++++++++++++++++++++++++++++- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/src/app.rs b/src/app.rs index 73d3d87..dc33e52 100644 --- a/src/app.rs +++ b/src/app.rs @@ -43,7 +43,7 @@ impl UseColor { match self { UseColor::Auto => atty::is(stream), UseColor::Always => true, - UseColor::Never => true, + UseColor::Never => false, } } } diff --git a/src/integration.rs b/src/integration.rs index 36cda75..ed6a1d2 100644 --- a/src/integration.rs +++ b/src/integration.rs @@ -917,7 +917,7 @@ fn unknown_recipes() { } #[test] -fn colors_with_context() { +fn color_always() { integration_test( &["--color", "always"], "b = a\na = `exit 100`\nbar:\n echo '{{`exit 200`}}'", @@ -927,6 +927,36 @@ fn colors_with_context() { ); } +#[test] +fn color_never() { + integration_test( + &["--color", "never"], + "b = a\na = `exit 100`\nbar:\n echo '{{`exit 200`}}'", + 100, + "", + "error: backtick failed with exit code 100 + | +2 | a = `exit 100` + | ^^^^^^^^^^ +", + ); +} + +#[test] +fn color_auto() { + integration_test( + &["--color", "auto"], + "b = a\na = `exit 100`\nbar:\n echo '{{`exit 200`}}'", + 100, + "", + "error: backtick failed with exit code 100 + | +2 | a = `exit 100` + | ^^^^^^^^^^ +", + ); +} + #[test] fn colors_no_context() { let text ="