-
-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add windows and *nix based env vars to control color output in logs (#…
…335)
- Loading branch information
Showing
3 changed files
with
111 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
use std::process::Command; | ||
|
||
fn execute_test(env_key: &str, env_val: &str) { | ||
let mut child_proc = Command::new("cargo") | ||
.args(&["run", "--example", "compile_time_config"]) | ||
.env(env_key, env_val) | ||
.spawn() | ||
.expect("Cargo command failed to start"); | ||
|
||
let ecode = child_proc.wait().expect("failed to wait on child"); | ||
|
||
assert!(ecode.success()); | ||
} | ||
|
||
// Maintaining as a single test to avoid blocking calls to the package cache | ||
#[test] | ||
fn test_no_color() { | ||
let keys = vec!["NO_COLOR", "CLICOLOR_FORCE", "CLICOLOR"]; | ||
|
||
for key in keys { | ||
execute_test(key, "1"); | ||
execute_test(key, "0"); | ||
} | ||
} |