-
Notifications
You must be signed in to change notification settings - Fork 500
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
--request
subcommand for testing (#2498)
- Loading branch information
Showing
10 changed files
with
115 additions
and
16 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
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,13 @@ | ||
use super::*; | ||
|
||
#[derive(Clone, Debug, Deserialize, PartialEq)] | ||
#[serde(rename_all = "kebab-case")] | ||
pub enum Request { | ||
EnvironmentVariable(String), | ||
} | ||
|
||
#[derive(Debug, Deserialize, PartialEq, Serialize)] | ||
#[serde(rename_all = "kebab-case")] | ||
pub enum Response { | ||
EnvironmentVariable(Option<OsString>), | ||
} |
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 @@ | ||
use super::*; | ||
|
||
#[test] | ||
fn environment_variable_set() { | ||
Test::new() | ||
.justfile( | ||
r#" | ||
export BAR := 'baz' | ||
@foo: | ||
'{{just_executable()}}' --request '{"environment-variable": "BAR"}' | ||
"#, | ||
) | ||
.response(Response::EnvironmentVariable(Some("baz".into()))) | ||
.run(); | ||
} | ||
|
||
#[test] | ||
fn environment_variable_missing() { | ||
Test::new() | ||
.justfile( | ||
r#" | ||
@foo: | ||
'{{just_executable()}}' --request '{"environment-variable": "FOO_BAR_BAZ"}' | ||
"#, | ||
) | ||
.response(Response::EnvironmentVariable(None)) | ||
.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