test-escape: Add tests for escaping bogus UTF-8 sequences

This commit is contained in:
msizanoen1 2023-03-01 21:48:08 +07:00
parent 00f57157f3
commit 582843ee37

View file

@ -196,6 +196,10 @@ TEST(shell_maybe_quote) {
test_shell_maybe_quote_one("głąb\002\003rząd", 0, "\"głąb\\002\\003rząd\"");
test_shell_maybe_quote_one("głąb\002\003rząd", SHELL_ESCAPE_POSIX, "$'głąb\\002\\003rząd'");
/* Bogus UTF-8 strings */
test_shell_maybe_quote_one("\250\350", 0, "\"\\250\\350\"");
test_shell_maybe_quote_one("\250\350", SHELL_ESCAPE_POSIX, "$'\\250\\350'");
}
static void test_quote_command_line_one(char **argv, const char *expected) {