File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change
1
+ use crate :: util;
2
+ use std:: fs:: { create_dir_all, write} ;
3
+
4
+ #[ test]
5
+ fn config_allow ( ) {
6
+ let temp_package = util:: temp_package ( Some ( "tests/build_scripts/ping.rs" ) , [ ] ) . unwrap ( ) ;
7
+
8
+ let home = util:: tempdir ( ) . unwrap ( ) ;
9
+ let config_build_wrap = home. path ( ) . join ( ".config/build-wrap" ) ;
10
+ create_dir_all ( & config_build_wrap) . unwrap ( ) ;
11
+ write ( config_build_wrap. join ( "allow.txt" ) , "temp-package\n " ) . unwrap ( ) ;
12
+
13
+ for allow in [ false , true ] {
14
+ let mut command = util:: build_with_build_wrap ( ) ;
15
+ command. env_remove ( "XDG_CONFIG_HOME" ) ;
16
+ if allow {
17
+ command. env ( "HOME" , home. path ( ) ) ;
18
+ }
19
+ command. current_dir ( & temp_package) ;
20
+
21
+ let output = util:: exec_forwarding_output ( command, false ) . unwrap ( ) ;
22
+ // smoelius: The command should succeed precisely when `HOME` is set.
23
+ assert_eq ! ( allow, output. status. success( ) ) ;
24
+ let stderr = std:: str:: from_utf8 ( & output. stderr ) . unwrap ( ) ;
25
+ assert ! ( stderr. contains( "command failed" ) ) ;
26
+ }
27
+ }
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ mod build_scripts;
3
3
mod build_wrap_cmd_changed;
4
4
mod cargo_target_dir;
5
5
mod ci;
6
+ mod config_allow;
6
7
mod custom_build_name;
7
8
mod dogfood;
8
9
mod enabled;
You can’t perform that action at this time.
0 commit comments