(args: &[&str])
| 1415 | #[test] |
| 1416 | fn p2_cli_stdio_write_flushes() -> Result<()> { |
| 1417 | fn run(args: &[&str]) -> Result<()> { |
| 1418 | println!("running {args:?}"); |
| 1419 | let mut child = get_wasmtime_command()? |
| 1420 | .args(args) |
| 1421 | .stdin(Stdio::piped()) |
| 1422 | .stdout(Stdio::piped()) |
| 1423 | .spawn()?; |
| 1424 | let mut stdout = child.stdout.take().unwrap(); |
| 1425 | let mut buf = [0; 10]; |
| 1426 | match stdout.read(&mut buf) { |
| 1427 | Ok(2) => assert_eq!(&buf[..2], b"> "), |
| 1428 | e => panic!("unexpected read result {e:?}"), |
| 1429 | } |
| 1430 | drop(stdout); |
| 1431 | drop(child.stdin.take().unwrap()); |
| 1432 | let status = child.wait()?; |
| 1433 | assert!(status.success()); |
| 1434 | Ok(()) |
| 1435 | } |
| 1436 | |
| 1437 | run(&["run", "-Spreview2=n", P2_CLI_STDIO_WRITE_FLUSHES])?; |
| 1438 | run(&["run", "-Spreview2=y", P2_CLI_STDIO_WRITE_FLUSHES])?; |
no test coverage detected