Initial commit: git-issue-commit CLI tool
This commit is contained in:
24
tests/cli_tests.rs
Normal file
24
tests/cli_tests.rs
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
#[cfg(test)]
|
||||||
|
mod cli_tests {
|
||||||
|
use clap::Parser;
|
||||||
|
|
||||||
|
#[derive(Parser, Debug)]
|
||||||
|
struct TestArgs {
|
||||||
|
#[arg(short, long)]
|
||||||
|
url: Option<String>,
|
||||||
|
#[arg(short, long)]
|
||||||
|
text: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_args_parse_url() {
|
||||||
|
let args = TestArgs::parse_from(["test", "--url", "https://github.com/user/repo/issues/123"]);
|
||||||
|
assert_eq!(args.url, Some("https://github.com/user/repo/issues/123".to_string()));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_args_parse_text() {
|
||||||
|
let args = TestArgs::parse_from(["test", "--text", "fix a bug in auth"]);
|
||||||
|
assert_eq!(args.text, Some("fix a bug in auth".to_string()));
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user