test(wfe-yaml): coverage pass to 90%+ and fix duration parsing bug
Added 51 tests: compiler hooks/parallel/error behavior (20),
validation error paths (15), shell integration tests (7),
lib.rs file loading (5), interpolation edge cases (4).
Fixed parse_duration_ms: "ms" suffix was unreachable because
strip_suffix('s') matched first. Now checks "ms" before "s".
Coverage: 40% → 90.3%. 326 total workspace tests.
This commit is contained in:
@@ -277,12 +277,13 @@ fn build_shell_config(step: &YamlStep) -> Result<ShellConfig, YamlWorkflowError>
|
||||
|
||||
fn parse_duration_ms(s: &str) -> Option<u64> {
|
||||
let s = s.trim();
|
||||
if let Some(secs) = s.strip_suffix('s') {
|
||||
// Check "ms" before "s" since strip_suffix('s') would also match "500ms"
|
||||
if let Some(ms) = s.strip_suffix("ms") {
|
||||
ms.trim().parse::<u64>().ok()
|
||||
} else if let Some(secs) = s.strip_suffix('s') {
|
||||
secs.trim().parse::<u64>().ok().map(|v| v * 1000)
|
||||
} else if let Some(mins) = s.strip_suffix('m') {
|
||||
mins.trim().parse::<u64>().ok().map(|v| v * 60 * 1000)
|
||||
} else if let Some(ms) = s.strip_suffix("ms") {
|
||||
ms.trim().parse::<u64>().ok()
|
||||
} else {
|
||||
s.parse::<u64>().ok()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user