Skip to main content

DnyResult

Struct DnyResult 

Source
pub struct DnyResult {
    pub stdout: String,
    pub stderr: String,
    pub exit_code: i32,
    pub build_duration: Duration,
    pub run_duration: Duration,
    pub ok: bool,
    pub system_err: SystemError,
}
Available on crate feature dyntest only.
Expand description

单次动态测试的结果,Display 输出彩色摘要(超长输出自动截断)。

§Feature Requirement

需要同时启用 "dyntest" 与 "std" 特性。

§Examples

use lib_unknown::dyntest::{BatchRunner, DnyTask};

let task = DnyTask::new("hello", r#"fn main() { println!("hi"); }"#);
let results = BatchRunner::new().run([task]);
assert_eq!(results.len(), 1);

Fields§

§stdout: String

被测程序标准输出全文。

§stderr: String

被测程序标准错误全文(已过滤 Compiling / Finished 行)。

§exit_code: i32

被测程序退出码;系统级失败时为 -2,默认构造时为 -1。

§build_duration: Duration

编译耗时。

§run_duration: Duration

运行耗时。

§ok: bool

被测程序是否以退出码 0 正常结束。

§system_err: SystemError

系统级错误,无则为 SystemError::None。

Trait Implementations§

Source§

impl Clone for DnyResult

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DnyResult

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for DnyResult

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Display for DnyResult

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.