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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
use std::ops::{Deref, DerefMut};
use clap::Parser;
use crate::common::CommonOptions;
#[derive(Clone, Debug, Default, Parser)]
#[clap(
setting = clap::AppSettings::DeriveDisplayOrder,
trailing_var_arg = true,
after_help = "Run `cargo help test` for more detailed information.\nRun `cargo test -- --help` for test binary options.")
]
pub struct Test {
#[clap(flatten)]
pub common: CommonOptions,
#[clap(
short = 'p',
long = "package",
value_name = "SPEC",
multiple_values = true
)]
pub packages: Vec<String>,
#[clap(long)]
pub workspace: bool,
#[clap(long, value_name = "SPEC", multiple_values = true)]
pub exclude: Vec<String>,
#[clap(long)]
pub all: bool,
#[clap(long)]
pub lib: bool,
#[clap(long, value_name = "NAME", multiple_values = true)]
pub bin: Vec<String>,
#[clap(long)]
pub bins: bool,
#[clap(long, value_name = "NAME", multiple_values = true)]
pub example: Vec<String>,
#[clap(long)]
pub examples: bool,
#[clap(long, value_name = "NAME", multiple_values = true)]
pub test: Vec<String>,
#[clap(long)]
pub tests: bool,
#[clap(long, value_name = "NAME", multiple_values = true)]
pub bench: Vec<String>,
#[clap(long)]
pub benches: bool,
#[clap(long)]
pub all_targets: bool,
#[clap(long)]
pub doc: bool,
#[clap(long)]
pub no_run: bool,
#[clap(long)]
pub no_fail_fast: bool,
#[clap(long)]
pub future_incompat_report: bool,
#[clap(value_name = "TESTNAME", takes_value = true)]
pub test_name: Option<String>,
#[clap(takes_value = true, multiple_values = true)]
pub args: Vec<String>,
}
impl Deref for Test {
type Target = CommonOptions;
fn deref(&self) -> &Self::Target {
&self.common
}
}
impl DerefMut for Test {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.common
}
}
impl From<Test> for crate::Build {
fn from(test: Test) -> Self {
crate::Build {
common: test.common,
packages: test.packages,
workspace: test.workspace,
exclude: test.exclude,
all: test.all,
lib: test.lib,
bin: test.bin,
bins: test.bins,
example: test.example,
examples: test.examples,
test: test.test,
tests: test.tests,
bench: test.bench,
benches: test.benches,
all_targets: test.all_targets,
future_incompat_report: test.future_incompat_report,
..Default::default()
}
}
}