| 20 | } |
| 21 | |
| 22 | pub fn subtest(parsed: &TestCommand) -> Result<Box<dyn SubTest>> { |
| 23 | assert_eq!(parsed.command, "compile"); |
| 24 | let mut test = TestCompile { |
| 25 | precise_output: false, |
| 26 | expect_fail: false, |
| 27 | }; |
| 28 | for option in parsed.options.iter() { |
| 29 | match option { |
| 30 | TestOption::Flag("precise-output") => test.precise_output = true, |
| 31 | TestOption::Flag("expect-fail") => test.expect_fail = true, |
| 32 | _ => anyhow::bail!("unknown option on {parsed}"), |
| 33 | } |
| 34 | } |
| 35 | Ok(Box::new(test)) |
| 36 | } |
| 37 | |
| 38 | impl SubTest for TestCompile { |
| 39 | fn name(&self) -> &'static str { |