Implement builtin test in Rust

This implements (but does not yet adopt) builtin test in Rust.
This commit is contained in:
ridiculousfish 2023-05-14 14:48:17 -07:00
parent a20985c738
commit 10a7de03e2
4 changed files with 1095 additions and 0 deletions

View File

@ -15,5 +15,6 @@ pub mod pwd;
pub mod random;
pub mod realpath;
pub mod r#return;
pub mod test;
pub mod r#type;
pub mod wait;

View File

@ -100,6 +100,7 @@ pub struct io_streams_t {
pub out: output_stream_t,
pub err: output_stream_t,
pub out_is_redirected: bool,
pub err_is_redirected: bool,
}
impl io_streams_t {
@ -107,12 +108,14 @@ impl io_streams_t {
let out = output_stream_t(streams.as_mut().get_out().unpin());
let err = output_stream_t(streams.as_mut().get_err().unpin());
let out_is_redirected = streams.as_mut().get_out_redirected();
let err_is_redirected = streams.as_mut().get_err_redirected();
let streams = streams.unpin();
io_streams_t {
streams,
out,
err,
out_is_redirected,
err_is_redirected,
}
}

File diff suppressed because it is too large Load Diff

View File

@ -512,6 +512,7 @@ struct io_streams_t : noncopyable_t {
output_stream_t &get_err() { return err; };
io_streams_t(const io_streams_t &) = delete;
bool get_out_redirected() { return out_is_redirected; };
bool get_err_redirected() { return err_is_redirected; };
bool ffi_stdin_is_directly_redirected() const { return stdin_is_directly_redirected; };
int ffi_stdin_fd() const { return stdin_fd; };
};