Skip to content

Commit 320ccbe

Browse files
committed
std: naive stdio print test in uvio
1 parent c0fba3c commit 320ccbe

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/libstd/rt/uv/uvio.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1734,3 +1734,23 @@ fn file_test_uvio_full_simple() {
17341734
file_test_uvio_full_simple_impl();
17351735
}
17361736
}
1737+
1738+
fn uvio_naive_print(input: &str) {
1739+
use str::StrSlice;
1740+
unsafe {
1741+
use libc::{STDOUT_FILENO};
1742+
let io = Local::unsafe_borrow::<IoFactoryObject>();
1743+
{
1744+
let mut fd = (*io).fs_from_raw_fd(STDOUT_FILENO, false);
1745+
let write_buf = input.as_bytes();
1746+
fd.write(write_buf);
1747+
}
1748+
}
1749+
}
1750+
1751+
#[test]
1752+
fn file_test_uvio_write_to_stdout() {
1753+
do run_in_newsched_task {
1754+
uvio_naive_print("jubilation\n");
1755+
}
1756+
}

0 commit comments

Comments
 (0)