Don't ignore --color=never (#56)

Fixes a bug where `--color=never` was ignored.
This commit is contained in:
Casey Rodarmor 2016-11-11 18:46:04 -08:00 committed by GitHub
parent ac7634000e
commit 2882b78de5
2 changed files with 32 additions and 2 deletions

View file

@ -43,7 +43,7 @@ impl UseColor {
match self {
UseColor::Auto => atty::is(stream),
UseColor::Always => true,
UseColor::Never => true,
UseColor::Never => false,
}
}
}

View file

@ -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 ="