fix(runtime tests): treat write's better
- unwrap on writeln!() - make sure "all" [0] is written in capture Signed-off-by: Charlotte Meyer <dev@buffet.sh>
This commit is contained in:
parent
87b911183c
commit
4a9d49fbd8
2 changed files with 7 additions and 4 deletions
|
@ -1,6 +1,10 @@
|
|||
mod math;
|
||||
|
||||
use std::{borrow::Cow, ffi::OsStr, io::Write};
|
||||
use std::{
|
||||
borrow::Cow,
|
||||
ffi::OsStr,
|
||||
io::{self, Write},
|
||||
};
|
||||
|
||||
use expect_test::{expect, Expect};
|
||||
use oyster_builtin_proc::builtin;
|
||||
|
@ -11,8 +15,7 @@ use crate::collect_output;
|
|||
|
||||
#[builtin(description = "test builtin")]
|
||||
fn test_builtin(_: &mut Shell, _: &[Cow<OsStr>]) {
|
||||
// XXX: this is a workaround around libtest's use of io::set_output_capture
|
||||
let _ = write!(std::io::stdout(), "this is a test\n");
|
||||
writeln!(io::stdout(), "this is a test").unwrap();
|
||||
}
|
||||
|
||||
fn check(ast: &ast::Code, expect: Expect) {
|
||||
|
|
|
@ -50,7 +50,7 @@ where
|
|||
let master = unsafe { File::from_raw_fd(master) };
|
||||
let mut slave = unsafe { File::from_raw_fd(slave) };
|
||||
|
||||
slave.write(&[0]).unwrap();
|
||||
slave.write_all(&[0]).unwrap();
|
||||
let mut r = BufReader::new(master);
|
||||
let mut buf = vec![];
|
||||
r.read_until(0, &mut buf).unwrap();
|
||||
|
|
Loading…
Reference in a new issue