From 5aff8cd34f7417616cb2286e34f22dcb4e2f9268 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Fri, 15 Aug 2025 09:20:00 -0500 Subject: [PATCH 1/4] fix(lexarg)!: Rename TestOpts::nocapture to TestOpts::no_capture --- crates/libtest-lexarg/src/lib.rs | 4 ++-- crates/libtest2-harness/src/harness.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/libtest-lexarg/src/lib.rs b/crates/libtest-lexarg/src/lib.rs index 3a402e4..1cb5157 100644 --- a/crates/libtest-lexarg/src/lib.rs +++ b/crates/libtest-lexarg/src/lib.rs @@ -27,7 +27,7 @@ pub struct TestOpts { pub run_ignored: RunIgnored, pub run_tests: bool, pub bench_benchmarks: bool, - pub nocapture: bool, + pub no_capture: bool, pub color: ColorConfig, pub format: OutputFormat, pub test_threads: Option, @@ -201,7 +201,7 @@ impl TestOptsBuilder { self.opts.list = true; } Long("no-capture") => { - self.opts.nocapture = true; + self.opts.no_capture = true; } Long("test-threads") => { let test_threads = parser diff --git a/crates/libtest2-harness/src/harness.rs b/crates/libtest2-harness/src/harness.rs index 129c186..4c9da41 100644 --- a/crates/libtest2-harness/src/harness.rs +++ b/crates/libtest2-harness/src/harness.rs @@ -247,7 +247,7 @@ fn run( notifier.notify(notify::Event::SuiteStart)?; let timer = std::time::Instant::now(); - if opts.nocapture { + if opts.no_capture { todo!("`--no-capture` is not yet supported"); } if opts.options.display_output { From 46e4c1dc8fafab6f55367915ebf6283981014be8 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Fri, 15 Aug 2025 09:22:01 -0500 Subject: [PATCH 2/4] fix(lexarg)!: Move Options::display_output to TestOpts::show_output --- crates/libtest-lexarg/src/lib.rs | 4 ++-- crates/libtest2-harness/src/harness.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/libtest-lexarg/src/lib.rs b/crates/libtest-lexarg/src/lib.rs index 1cb5157..c9806ba 100644 --- a/crates/libtest-lexarg/src/lib.rs +++ b/crates/libtest-lexarg/src/lib.rs @@ -28,6 +28,7 @@ pub struct TestOpts { pub run_tests: bool, pub bench_benchmarks: bool, pub no_capture: bool, + pub show_output: bool, pub color: ColorConfig, pub format: OutputFormat, pub test_threads: Option, @@ -92,7 +93,6 @@ impl Default for OutputFormat { /// In case we want to add other options as well, just add them in this struct. #[derive(Copy, Clone, Debug, Default)] pub struct Options { - pub display_output: bool, pub panic_abort: bool, } @@ -257,7 +257,7 @@ impl TestOptsBuilder { }); } Long("show-output") => { - self.opts.options.display_output = true; + self.opts.show_output = true; } Short("Z") => { let feature = parser diff --git a/crates/libtest2-harness/src/harness.rs b/crates/libtest2-harness/src/harness.rs index 4c9da41..0418d9b 100644 --- a/crates/libtest2-harness/src/harness.rs +++ b/crates/libtest2-harness/src/harness.rs @@ -250,7 +250,7 @@ fn run( if opts.no_capture { todo!("`--no-capture` is not yet supported"); } - if opts.options.display_output { + if opts.show_output { todo!("`--show-output` is not yet supported"); } if opts.options.panic_abort { From 7e2f5966a9d4b640e67684346972bee35dbb85a3 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Fri, 15 Aug 2025 09:26:10 -0500 Subject: [PATCH 3/4] fix(lexarg)!: Remove pamic_abort --- crates/libtest-lexarg/src/lib.rs | 10 ---------- crates/libtest2-harness/src/harness.rs | 3 --- 2 files changed, 13 deletions(-) diff --git a/crates/libtest-lexarg/src/lib.rs b/crates/libtest-lexarg/src/lib.rs index c9806ba..8cc2242 100644 --- a/crates/libtest-lexarg/src/lib.rs +++ b/crates/libtest-lexarg/src/lib.rs @@ -37,7 +37,6 @@ pub struct TestOpts { /// May run a few more tests due to threading, but will /// abort as soon as possible. pub fail_fast: bool, - pub options: Options, pub allowed_unstable: Vec, } @@ -87,15 +86,6 @@ impl Default for OutputFormat { } } -/// Options for the test run defined by the caller (instead of CLI arguments) (see -/// [`TestOpts::options`]) -/// -/// In case we want to add other options as well, just add them in this struct. -#[derive(Copy, Clone, Debug, Default)] -pub struct Options { - pub panic_abort: bool, -} - pub const UNSTABLE_OPTIONS: &str = "unstable-options"; pub const OPTIONS_HELP: &str = r#" diff --git a/crates/libtest2-harness/src/harness.rs b/crates/libtest2-harness/src/harness.rs index 0418d9b..a11268c 100644 --- a/crates/libtest2-harness/src/harness.rs +++ b/crates/libtest2-harness/src/harness.rs @@ -253,9 +253,6 @@ fn run( if opts.show_output { todo!("`--show-output` is not yet supported"); } - if opts.options.panic_abort { - todo!("panic-abort is not yet supported"); - } let threads = opts.test_threads.map(|t| t.get()).unwrap_or(1); From cb6c94a7cf01c8b9ff80efa8db2ae5674db6610e Mon Sep 17 00:00:00 2001 From: Ed Page Date: Fri, 15 Aug 2025 09:27:54 -0500 Subject: [PATCH 4/4] fix(lexarg)!: Make TestOpts non-exhaustive --- crates/libtest-lexarg/src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/libtest-lexarg/src/lib.rs b/crates/libtest-lexarg/src/lib.rs index 8cc2242..9d5522a 100644 --- a/crates/libtest-lexarg/src/lib.rs +++ b/crates/libtest-lexarg/src/lib.rs @@ -20,6 +20,7 @@ use lexarg_error::ErrorContext; /// /// To parse, see [`TestOptsBuilder`] #[derive(Debug, Default)] +#[non_exhaustive] pub struct TestOpts { pub list: bool, pub filters: Vec,