mirror of
https://github.com/storytold/photocraft.git
synced 2026-10-24 09:57:08 -06:00
Tests: report a bad PHOTOCRAFT_SWEEP_PART with assert!, which testkit's lints allow
This commit is contained in:
@@ -20,10 +20,11 @@ impl Sweep {
|
||||
}
|
||||
let parts = parts.max(1);
|
||||
let part = match std::env::var("PHOTOCRAFT_SWEEP_PART") {
|
||||
Ok(v) => match v.parse::<u64>() {
|
||||
Ok(p) if p < parts => p,
|
||||
_ => panic!("PHOTOCRAFT_SWEEP_PART={v:?} is not a part number below {parts}"),
|
||||
},
|
||||
Ok(v) => {
|
||||
let p = v.parse::<u64>().unwrap_or(u64::MAX);
|
||||
assert!(p < parts, "PHOTOCRAFT_SWEEP_PART={v:?} is not a part number below {parts}");
|
||||
p
|
||||
}
|
||||
Err(_) => SystemTime::now().duration_since(UNIX_EPOCH).map(|d| d.as_secs() / 86_400).unwrap_or_default() % parts,
|
||||
};
|
||||
eprintln!("sweep part {part} of {parts}: replay with PHOTOCRAFT_SWEEP_PART={part}, run every part with PHOTOCRAFT_FULL_SWEEP=1");
|
||||
|
||||
Reference in New Issue
Block a user