Skip to content

Commit bedc35f

Browse files
authored
fix(lexarg)!: Clean up the API (#106)
2 parents be981b3 + cb6c94a commit bedc35f

2 files changed

Lines changed: 7 additions & 19 deletions

File tree

crates/libtest-lexarg/src/lib.rs

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,16 @@ use lexarg_error::ErrorContext;
2020
///
2121
/// To parse, see [`TestOptsBuilder`]
2222
#[derive(Debug, Default)]
23+
#[non_exhaustive]
2324
pub struct TestOpts {
2425
pub list: bool,
2526
pub filters: Vec<String>,
2627
pub filter_exact: bool,
2728
pub run_ignored: RunIgnored,
2829
pub run_tests: bool,
2930
pub bench_benchmarks: bool,
30-
pub nocapture: bool,
31+
pub no_capture: bool,
32+
pub show_output: bool,
3133
pub color: ColorConfig,
3234
pub format: OutputFormat,
3335
pub test_threads: Option<std::num::NonZeroUsize>,
@@ -36,7 +38,6 @@ pub struct TestOpts {
3638
/// May run a few more tests due to threading, but will
3739
/// abort as soon as possible.
3840
pub fail_fast: bool,
39-
pub options: Options,
4041
pub allowed_unstable: Vec<String>,
4142
}
4243

@@ -86,16 +87,6 @@ impl Default for OutputFormat {
8687
}
8788
}
8889

89-
/// Options for the test run defined by the caller (instead of CLI arguments) (see
90-
/// [`TestOpts::options`])
91-
///
92-
/// In case we want to add other options as well, just add them in this struct.
93-
#[derive(Copy, Clone, Debug, Default)]
94-
pub struct Options {
95-
pub display_output: bool,
96-
pub panic_abort: bool,
97-
}
98-
9990
pub const UNSTABLE_OPTIONS: &str = "unstable-options";
10091

10192
pub const OPTIONS_HELP: &str = r#"
@@ -201,7 +192,7 @@ impl TestOptsBuilder {
201192
self.opts.list = true;
202193
}
203194
Long("no-capture") => {
204-
self.opts.nocapture = true;
195+
self.opts.no_capture = true;
205196
}
206197
Long("test-threads") => {
207198
let test_threads = parser
@@ -257,7 +248,7 @@ impl TestOptsBuilder {
257248
});
258249
}
259250
Long("show-output") => {
260-
self.opts.options.display_output = true;
251+
self.opts.show_output = true;
261252
}
262253
Short("Z") => {
263254
let feature = parser

crates/libtest2-harness/src/harness.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -247,15 +247,12 @@ fn run(
247247
notifier.notify(notify::Event::SuiteStart)?;
248248
let timer = std::time::Instant::now();
249249

250-
if opts.nocapture {
250+
if opts.no_capture {
251251
todo!("`--no-capture` is not yet supported");
252252
}
253-
if opts.options.display_output {
253+
if opts.show_output {
254254
todo!("`--show-output` is not yet supported");
255255
}
256-
if opts.options.panic_abort {
257-
todo!("panic-abort is not yet supported");
258-
}
259256

260257
let threads = opts.test_threads.map(|t| t.get()).unwrap_or(1);
261258

0 commit comments

Comments
 (0)