()
| 3580 | |
| 3581 | #[mz_ore::test] |
| 3582 | fn test_parse_option() { |
| 3583 | struct TestCase { |
| 3584 | input: &'static str, |
| 3585 | expect: Result<(&'static str, &'static str), ()>, |
| 3586 | } |
| 3587 | let tests = vec![ |
| 3588 | TestCase { |
| 3589 | input: "", |
| 3590 | expect: Err(()), |
| 3591 | }, |
| 3592 | TestCase { |
| 3593 | input: "--", |
| 3594 | expect: Err(()), |
| 3595 | }, |
| 3596 | TestCase { |
| 3597 | input: "--c", |
| 3598 | expect: Err(()), |
| 3599 | }, |
| 3600 | TestCase { |
| 3601 | input: "a=b", |
| 3602 | expect: Err(()), |
| 3603 | }, |
| 3604 | TestCase { |
| 3605 | input: "--a=b", |
| 3606 | expect: Ok(("a", "b")), |
| 3607 | }, |
| 3608 | TestCase { |
| 3609 | input: "--ca=b", |
| 3610 | expect: Ok(("ca", "b")), |
| 3611 | }, |
| 3612 | TestCase { |
| 3613 | input: "-ca=b", |
| 3614 | expect: Ok(("a", "b")), |
| 3615 | }, |
| 3616 | // Unclear what this should error, but at least test it. |
| 3617 | TestCase { |
| 3618 | input: "--=", |
| 3619 | expect: Ok(("", "")), |
| 3620 | }, |
| 3621 | ]; |
| 3622 | for test in tests { |
| 3623 | let got = parse_option(test.input); |
| 3624 | assert_eq!(got, test.expect, "input: {}", test.input); |
| 3625 | } |
| 3626 | } |
| 3627 | |
| 3628 | #[mz_ore::test] |
| 3629 | fn test_split_options() { |
nothing calls this directly
no test coverage detected