summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAlex Saveau <saveau.alexandre@gmail.com>2023-04-26 01:02:17 -0700
committerGitHub <noreply@github.com>2023-04-26 10:02:17 +0200
commitf740c0b03fbf2916c31044b5cec262835325d0c7 (patch)
tree85a84daa3ae764738d8b4c2201f55c2831161a47 /tests
parent0d1037a58c534c1ef26e69d430f872b82f465378 (diff)
Support picking the last subtest by using a random big number (#970)
Diffstat (limited to 'tests')
-rw-r--r--tests/src/tests.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/src/tests.rs b/tests/src/tests.rs
index cf89e1b2..0e22084c 100644
--- a/tests/src/tests.rs
+++ b/tests/src/tests.rs
@@ -45,7 +45,8 @@ struct Args {
filter: Vec<String>,
/// runs only the specified subtest
#[arg(short, long)]
- subtest: Option<usize>,
+ #[arg(allow_hyphen_values = true)]
+ subtest: Option<isize>,
#[arg(long)]
exact: bool,
#[arg(long, default_value_t = env::var_os("UPDATE_EXPECT").is_some())]
@@ -368,6 +369,10 @@ fn test(
let parts: Vec<_> = text.split("\n---").collect();
for (i, &part) in parts.iter().enumerate() {
if let Some(x) = args.subtest {
+ let x = usize::try_from(
+ x.rem_euclid(isize::try_from(parts.len()).unwrap_or_default()),
+ )
+ .unwrap();
if x != i {
writeln!(output, " Skipped subtest {i}.").unwrap();
continue;