1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
use crate::TestStatus;
use super::report::{ BoxedReport };
use super::plan::Plan;
use super::opts::Opts;
#[derive(Debug)]
pub(super) struct Info {
pub report: BoxedReport,
}
impl Info {
pub(super) fn new(parent_plan: &Plan, opts: &Opts) -> Self {
let mut report = parent_plan.info.with(|i| BoxedReport::from_parent(&i.report));
report.generic.name = opts.name.clone();
report.generic.description = opts.description.clone();
report.generic.comment = opts.comment.clone();
report.num_planned = opts.total_count;
if opts.do_skip {
report.status = TestStatus::Skip;
report.reason = opts.skip_reason.clone();
}
Self {
report: report,
}
}
pub fn emit_report(&self) {
crate::report::emit(&self.report).expect("failed to write report");
}
pub fn append_report(&mut self, report: Box<crate::ReportPlan>) {
self.report.append_plan(report);
}
pub fn record_duration(&mut self, duration: std::time::Duration) {
self.report.record_duration(duration)
}
}
#[allow(clippy::derivable_impls)]
impl Default for Info {
fn default() -> Self {
Self {
report: BoxedReport::default()
}
}
}