-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extract workflow and improve argument parsing.
- Loading branch information
Showing
5 changed files
with
39 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
//! | ||
//! Compiler tester workflows | ||
//! | ||
/// | ||
/// Describes sets of actions that compiler tester is able to perform. | ||
/// | ||
#[derive(Debug)] | ||
pub enum Workflow { | ||
/// Only build tests but not execute them. | ||
BuildOnly, | ||
/// Build and execute tests. | ||
BuildAndRun, | ||
} | ||
use std::str::FromStr; | ||
|
||
// any error type implementing Display is acceptable. | ||
type ParseError = &'static str; | ||
|
||
impl FromStr for Workflow { | ||
type Err = ParseError; | ||
fn from_str(day: &str) -> Result<Self, Self::Err> { | ||
match day { | ||
"build" => Ok(Workflow::BuildOnly), | ||
"run" => Ok(Workflow::BuildAndRun), | ||
_ => Err("Could not parse workflow. Supported workflows: build, run."), | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters