(arguments: &[String], name: &str)
| 436 | } |
| 437 | |
| 438 | fn argument_value(arguments: &[String], name: &str) -> Option<String> { |
| 439 | arguments |
| 440 | .windows(2) |
| 441 | .find(|window| window.first().is_some_and(|value| value == name)) |
| 442 | .and_then(|window| window.get(1)) |
| 443 | .map(|value| value.trim()) |
| 444 | .filter(|value| !value.is_empty()) |
| 445 | .map(ToOwned::to_owned) |
| 446 | } |
| 447 | |
| 448 | fn optional_argument_matches(arguments: &[String], name: &str, expected: Option<&str>) -> bool { |
| 449 | argument_value(arguments, name).as_deref() == expected |
no test coverage detected