| 1 | //! Custom flag for setting the edition for all tests |
| 2 | |
| 3 | use super::Flag; |
| 4 | use crate::{build_manager::BuildManager, per_test_config::TestConfig, Errored}; |
| 5 | |
| 6 | #[derive (Debug)] |
| 7 | /// Set the edition of the tests |
| 8 | pub struct Edition(pub String); |
| 9 | |
| 10 | impl Flag for Edition { |
| 11 | fn must_be_unique(&self) -> bool { |
| 12 | true |
| 13 | } |
| 14 | fn clone_inner(&self) -> Box<dyn Flag> { |
| 15 | Box::new(Edition(self.0.clone())) |
| 16 | } |
| 17 | |
| 18 | fn apply( |
| 19 | &self, |
| 20 | cmd: &mut std::process::Command, |
| 21 | _config: &TestConfig, |
| 22 | _build_manager: &BuildManager, |
| 23 | ) -> Result<(), Errored> { |
| 24 | cmd.arg("--edition" ).arg(&self.0); |
| 25 | Ok(()) |
| 26 | } |
| 27 | } |
| 28 | |