Skip to content

Commit acefcea

Browse files
committed
Add $HOME/.config/build-wrap/allow.txt test
1 parent 0e1f8ff commit acefcea

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

tests/integration/config_allow.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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+
}

tests/integration/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ mod build_scripts;
33
mod build_wrap_cmd_changed;
44
mod cargo_target_dir;
55
mod ci;
6+
mod config_allow;
67
mod custom_build_name;
78
mod dogfood;
89
mod enabled;

0 commit comments

Comments
 (0)