Fixes
This commit is contained in:
@ -212,6 +212,36 @@ BOOL TestMultiLine()
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// 6. Complex Command Line Arguments Handling
|
||||
// -------------------------------------------------------------------------
|
||||
BOOL TestComplexArguments()
|
||||
{
|
||||
// Should parse as 3 arguments:
|
||||
// 1. -DDEFINED_MSG="Hello World"
|
||||
// 2. -v
|
||||
// 3. path/to/file
|
||||
String complexArgs = "-DDEFINED_MSG=\\\"Hello World\\\" -v path/to/file";
|
||||
|
||||
// We can't easily inspect the child process argv in this unit test framework without
|
||||
// writing a dedicated child program that prints its argv.
|
||||
// However, for now, we ensure it doesn't crash or return error code 127.
|
||||
|
||||
// Use "echo" to verify what it received.
|
||||
// Expected output: -DDEFINED_MSG="Hello World" -v path/to/file
|
||||
String cmd = "/bin/echo";
|
||||
|
||||
String captured;
|
||||
auto result = ProcessOps::SpawnProcessSync(cmd, complexArgs, [&](StringView line) { captured += line; });
|
||||
|
||||
IAT_CHECK(result.has_value());
|
||||
IAT_CHECK_EQ(*result, 0);
|
||||
|
||||
// Verify the quotes were preserved in the output if the shell handled them correctly
|
||||
IAT_CHECK(captured.find("Hello World") != String::npos);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Registration
|
||||
// -------------------------------------------------------------------------
|
||||
@ -222,6 +252,7 @@ IAT_ADD_TEST(TestExitCodes);
|
||||
IAT_ADD_TEST(TestMissingExe);
|
||||
IAT_ADD_TEST(TestLargeOutput);
|
||||
IAT_ADD_TEST(TestMultiLine);
|
||||
IAT_ADD_TEST(TestComplexArguments);
|
||||
IAT_END_TEST_LIST()
|
||||
|
||||
IAT_END_BLOCK()
|
||||
|
||||
Reference in New Issue
Block a user