blob: 0c97ad559b8d538acb89bbb854b49cb0f1c18585 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
use std::fs;
use eyre::WrapErr;
use std::thread::sleep;
use std::time::Duration;
mod utils;
use utils::{make, R};
#[test]
fn basic_test() -> R {
let dir = tempfile::tempdir()?;
let file = "
based-on-what: based-on-this
\techo hi
";
fs::write(dir.path().join("Makefile"), file)?;
let result = make(&dir)?;
assert!(!result.status.success());
assert!(String::from_utf8(result.stderr)?.contains("based-on-this"));
fs::write(dir.path().join("based-on-this"), "")?;
let result = make(&dir)?;
assert!(result.status.success());
assert!(String::from_utf8(result.stdout)?.contains("echo hi"));
let result = make(&dir)?;
assert!(result.status.success());
assert!(String::from_utf8(result.stdout)?.contains("echo hi"));
fs::write(dir.path().join("based-on-what"), "")?;
let result = make(&dir)?;
assert!(result.status.success());
assert!(!String::from_utf8(result.stdout)?.contains("echo hi"));
sleep(Duration::from_millis(1000));
fs::write(dir.path().join("based-on-this"), "")?;
let result = make(&dir)?;
assert!(result.status.success());
assert!(String::from_utf8(result.stdout)?.contains("echo hi"));
Ok(())
}
|