1
0
mirror of https://github.com/containers/bootc.git synced 2026-02-05 15:45:53 +01:00

utils: Strengthen quoted testing

Verify we see exactly one token.

Signed-off-by: Colin Walters <walters@verbum.org>
This commit is contained in:
Colin Walters
2025-05-09 13:45:27 -04:00
parent 25c12b8ebc
commit 7732fe6d7b

View File

@@ -87,7 +87,12 @@ mod tests {
(r#"/path/"withquotes'"#, r#""/path/\"withquotes'""#),
];
for (v, quoted) in cases {
assert_eq!(quoted, format!("{}", PathQuotedDisplay::new(&v)));
let q = PathQuotedDisplay::new(&v).to_string();
assert_eq!(quoted, q.as_str());
// Also sanity check there's exactly one token
let token = shlex::split(&q).unwrap();
assert_eq!(1, token.len());
assert_eq!(v, token[0]);
}
}