@@ -2,7 +2,7 @@ use std::process::Command;
2
2
3
3
fn execute_test ( env_key : & str , env_val : & str ) {
4
4
let mut child_proc = Command :: new ( "cargo" )
5
- . args ( & [ "run" , "--example" , "compile_time_config " ] )
5
+ . args ( & [ "run" , "--example" , "color_control " ] )
6
6
. env ( env_key, env_val)
7
7
. spawn ( )
8
8
. expect ( "Cargo command failed to start" ) ;
@@ -14,11 +14,39 @@ fn execute_test(env_key: &str, env_val: &str) {
14
14
15
15
// Maintaining as a single test to avoid blocking calls to the package cache
16
16
#[ test]
17
- fn test_no_color ( ) {
17
+ fn test_single_var ( ) {
18
18
let keys = vec ! [ "NO_COLOR" , "CLICOLOR_FORCE" , "CLICOLOR" ] ;
19
19
20
20
for key in keys {
21
21
execute_test ( key, "1" ) ;
22
22
execute_test ( key, "0" ) ;
23
23
}
24
24
}
25
+
26
+ #[ test]
27
+ fn test_no_color_vs_force ( ) {
28
+ let mut child_proc = Command :: new ( "cargo" )
29
+ . args ( & [ "run" , "--example" , "color_control" ] )
30
+ . env ( "NO_COLOR" , "1" )
31
+ . env ( "CLICOLOR_FORCE" , "1" )
32
+ . spawn ( )
33
+ . expect ( "Cargo command failed to start" ) ;
34
+
35
+ let ecode = child_proc. wait ( ) . expect ( "failed to wait on child" ) ;
36
+
37
+ assert ! ( ecode. success( ) ) ;
38
+ }
39
+
40
+ #[ test]
41
+ fn test_no_color_vs_regular ( ) {
42
+ let mut child_proc = Command :: new ( "cargo" )
43
+ . args ( & [ "run" , "--example" , "color_control" ] )
44
+ . env ( "NO_COLOR" , "1" )
45
+ . env ( "CLICOLOR" , "1" )
46
+ . spawn ( )
47
+ . expect ( "Cargo command failed to start" ) ;
48
+
49
+ let ecode = child_proc. wait ( ) . expect ( "failed to wait on child" ) ;
50
+
51
+ assert ! ( ecode. success( ) ) ;
52
+ }
0 commit comments