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
/*
* Testing running Ledger in REPL mode.
*/
/*
use std::{process::Command, thread::sleep, time::Duration};
use interactive_process::InteractiveProcess;
#[test]
fn run_repl() {
let mut cmd = Command::new("ledger");
cmd.args(["-f", "tests/journal.ledger"]);
let mut proc = InteractiveProcess::new(cmd, |line| {
let text = line.unwrap();
if !text.starts_with(']') {
return;
}
println!("Got: {}", text);
})
.unwrap();
// sleep(Duration::from_secs(1));
proc.send("b cash").unwrap();
sleep(Duration::from_secs(1));
// sleep(Duration::from_millis(1));
// proc.close().kill().unwrap();
// Close by issuing a command.
proc.send("quit").unwrap();
proc.wait().unwrap();
//sleep(Duration::from_millis(1));
assert!(true);
}
*/