fix: Properly parse Expressions, Idents, and Literals

This commit is contained in:
2025-01-11 11:16:23 -05:00
parent 295623efb2
commit ebc4cc0bd4
4 changed files with 80 additions and 9 deletions

View File

@@ -109,7 +109,7 @@ fn match_statement(#[case] match_arg: TestArgs, #[case] expected: &str) {
#[case(None, None, r#""echo" "test""#)]
#[case(Some("arg"), None, r#""echo" "test" "arg""#)]
#[case(None, Some("arg"), r#""echo" "test" "multi" "arg""#)]
#[case(Some("1"), Some("2"), r#""echo" "test" "1" "multi" "2""#)]
#[case(Some("1"), Some("2"), r#""echo" "test" "1" "multi=2""#)]
fn multi_match(#[case] single: Option<&str>, #[case] multi: Option<&str>, #[case] expected: &str) {
let command = cmd!(
"echo",
@@ -118,7 +118,7 @@ fn multi_match(#[case] single: Option<&str>, #[case] multi: Option<&str>, #[case
(None, None) => [],
(Some(single), None) => single,
(None, Some(multi)) => ["multi", multi],
(Some(single), Some(multi)) => [single, "multi", multi],
(Some(single), Some(multi)) => [single, format!("multi={multi}")],
},
);