use super::shq; #[test] fn shq_quotes_plain_word() { assert_eq!(shq("--kv-cache-dtype"), "'--kv-cache-dtype'"); } #[test] fn shq_escapes_interior_quote() { assert_eq!(shq("it's"), r#"'it'\''s'"#); } #[test] fn shq_passes_through_already_quoted_token() { // an operator pre-quoted value (e.g. JSON arg) is a single-quoted shell // word already -> pass through, do not double-quote it. assert_eq!(shq("'{\"cuda\":\"x\"}'"), "'{\"cuda\":\"x\"}'"); } #[test] fn shq_quotes_injectable_value_whole() { // metachars keep the whole value as ONE quoted argument. assert_eq!(shq("x; touch /tmp/pwned"), "'x; touch /tmp/pwned'"); } #[test] fn shq_quotes_unbalanced_leading_quote() { // a single leading quote is not a complete token -> still escaped. assert_eq!(shq("'untuple"), r#"''\''untuple'"#); }