Add some tests for execve()

This commit is contained in:
Justine Tunney 2022-10-02 14:58:14 -07:00
parent 2526a9b8c7
commit daca5499b9
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
6 changed files with 81 additions and 14 deletions

View file

@ -175,11 +175,11 @@ TEST(GetDosArgv, cmdToil) {
size_t size = ARG_MAX / 2;
char *buf = malloc(size * sizeof(char));
char **argv = malloc(max * sizeof(char *));
EXPECT_EQ(3, GetDosArgv(u"cmd.exe /C \"echo hi >\"\"\"foo bar.txt\"\"\"\"",
EXPECT_EQ(3, GetDosArgv(u"cmd.exe /C \"echo hi >\"\"\"𝑓𝑜𝑜 bar.txt\"\"\"\"",
buf, size, argv, max));
EXPECT_STREQ("cmd.exe", argv[0]);
EXPECT_STREQ("/C", argv[1]);
EXPECT_STREQ("echo hi >\"foo bar.txt\"", argv[2]);
EXPECT_STREQ("echo hi >\"𝑓𝑜𝑜 bar.txt\"", argv[2]);
EXPECT_EQ(NULL, argv[3]);
free(argv);
free(buf);