Skip to content

Commit 13a023b

Browse files
committed
add tests for process_lines and update changelog
1 parent 1c2e9fd commit 13a023b

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
55

66
## Unreleased
77

8+
### Fixed
9+
10+
- Fix `Command::process_lines` not working in sandboxed enviroments.
11+
812
## [0.6.0] - 2020-04-01
913

1014
### Added

tests/buildtest/mod.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,32 @@ fn test_hello_world() {
2323
});
2424
}
2525

26+
#[test]
27+
fn test_process_lines() {
28+
runner::run("hello-world", |run| {
29+
run.build(SandboxBuilder::new().enable_networking(false), |build| {
30+
let storage = rustwide::logging::LogStorage::new(LevelFilter::Info);
31+
let mut ex = false;
32+
rustwide::logging::capture(&storage, || -> Result<_, Error> {
33+
build
34+
.cargo()
35+
.process_lines(&mut |line: &str| {
36+
if line.contains("Hello, world!") {
37+
ex = true;
38+
}
39+
})
40+
.args(&["run"])
41+
.run()?;
42+
Ok(())
43+
})?;
44+
45+
assert!(ex);
46+
Ok(())
47+
})?;
48+
Ok(())
49+
});
50+
}
51+
2652
#[test]
2753
#[cfg(not(windows))]
2854
fn test_sandbox_oom() {

0 commit comments

Comments
 (0)