-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: begin lua-side stdlib, implement combinators & validators
- Loading branch information
Showing
17 changed files
with
798 additions
and
79 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
use argh::FromArgs; | ||
|
||
use crate::situation::SituationSpec; | ||
|
||
/// situational-mock-based load testing | ||
#[derive(FromArgs)] | ||
struct CmdArgsBase { | ||
/// integral multiplier for grunt counts (minimum 1) | ||
#[argh(option, short = 'm', default = "1")] | ||
multiplier: usize, | ||
|
||
/// base URL for all situations in this run | ||
#[argh(positional)] | ||
base_url: String, | ||
|
||
// work around https://github.com/google/argh/issues/13 wherein repeatable positional arguments | ||
// (situations, in this struct) allow any vec length 0+, where we require a vec length 1+. this | ||
// could be hacked around with some From magic and a custom Vec, but this is more | ||
// straightforward | ||
/// path to a RON file in seatrial(5) situation config format | ||
#[argh(positional)] | ||
req_situation: SituationSpec, | ||
|
||
/// optional paths to additional RON files in seatrial(5) situation config format | ||
#[argh(positional)] | ||
situations: Vec<SituationSpec>, | ||
} | ||
|
||
#[derive(Clone, Debug)] | ||
pub struct CmdArgs { | ||
/// integral multiplier for grunt counts (minimum 1) | ||
pub multiplier: usize, | ||
|
||
/// base URL for all situations in this run | ||
pub base_url: String, | ||
|
||
/// paths to RON files in seatrial(5) situation config format | ||
pub situations: Vec<SituationSpec>, | ||
} | ||
|
||
/// flatten situations into a single vec (see docs about CmdArgsBase::req_situation) | ||
impl From<CmdArgsBase> for CmdArgs { | ||
fn from(mut it: CmdArgsBase) -> Self { | ||
it.situations.insert(0, it.req_situation.clone()); | ||
|
||
Self { | ||
multiplier: it.multiplier, | ||
base_url: it.base_url, | ||
situations: it.situations, | ||
} | ||
} | ||
} | ||
|
||
pub fn parse_args() -> CmdArgs { | ||
argh::from_env::<CmdArgsBase>().into() | ||
} |
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
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,10 @@ | ||
use rlua::{Lua, Result as LuaResult}; | ||
|
||
pub mod validation_result; | ||
|
||
pub use validation_result::{attach_validationresult, ValidationResult}; | ||
|
||
pub fn attach_seatrial_stdlib<'a>(lua: &'a Lua) -> LuaResult<()> { | ||
attach_validationresult(lua)?; | ||
Ok(()) | ||
} |
Oops, something went wrong.