in src/host/ut_host/ConsoleArgumentsTests.cpp [266:489]
void ConsoleArgumentsTests::ClientCommandlineTests()
{
std::wstring commandline;
commandline = L"conhost.exe -- foo";
ArgTestsRunner(L"#1 Check that a simple explicit commandline is found",
commandline,
INVALID_HANDLE_VALUE,
INVALID_HANDLE_VALUE,
ConsoleArguments(commandline,
L"foo", // clientCommandLine
INVALID_HANDLE_VALUE,
INVALID_HANDLE_VALUE,
L"", // vtMode
0, // width
0, // height
false, // forceV1
false, // forceNoHandoff
false, // headless
true, // createServerHandle
0, // serverHandle
0, // signalHandle
false, // inheritCursor
false), // runAsComServer
true); // successful parse?
commandline = L"conhost.exe foo";
ArgTestsRunner(L"#2 Check that a simple implicit commandline is found",
commandline,
INVALID_HANDLE_VALUE,
INVALID_HANDLE_VALUE,
ConsoleArguments(commandline,
L"foo", // clientCommandLine
INVALID_HANDLE_VALUE,
INVALID_HANDLE_VALUE,
L"", // vtMode
0, // width
0, // height
false, // forceV1
false, // forceNoHandoff
false, // headless
true, // createServerHandle
0, // serverHandle
0, // signalHandle
false, // inheritCursor
false), // runAsComServer
true); // successful parse?
commandline = L"conhost.exe foo -- bar";
ArgTestsRunner(L"#3 Check that a implicit commandline with other expected args is treated as a whole client commandline (1)",
commandline,
INVALID_HANDLE_VALUE,
INVALID_HANDLE_VALUE,
ConsoleArguments(commandline,
L"foo -- bar", // clientCommandLine
INVALID_HANDLE_VALUE,
INVALID_HANDLE_VALUE,
L"", // vtMode
0, // width
0, // height
false, // forceV1
false, // forceNoHandoff
false, // headless
true, // createServerHandle
0, // serverHandle
0, // signalHandle
false, // inheritCursor
false), // runAsComServer
true); // successful parse?
commandline = L"conhost.exe --vtmode foo foo -- bar";
ArgTestsRunner(L"#4 Check that a implicit commandline with other expected args is treated as a whole client commandline (2)",
commandline,
INVALID_HANDLE_VALUE,
INVALID_HANDLE_VALUE,
ConsoleArguments(commandline,
L"foo -- bar", // clientCommandLine
INVALID_HANDLE_VALUE,
INVALID_HANDLE_VALUE,
L"foo", // vtMode
0, // width
0, // height
false, // forceV1
false, // forceNoHandoff
false, // headless
true, // createServerHandle
0, // serverHandle
0, // signalHandle
false, // inheritCursor
false), // runAsComServer
true); // successful parse?
commandline = L"conhost.exe console --vtmode foo foo -- bar";
ArgTestsRunner(L"#5 Check that a implicit commandline with other expected args is treated as a whole client commandline (3)",
commandline,
INVALID_HANDLE_VALUE,
INVALID_HANDLE_VALUE,
ConsoleArguments(commandline,
L"console --vtmode foo foo -- bar", // clientCommandLine
INVALID_HANDLE_VALUE,
INVALID_HANDLE_VALUE,
L"", // vtMode
0, // width
0, // height
false, // forceV1
false, // forceNoHandoff
false, // headless
true, // createServerHandle
0, // serverHandle
0, // signalHandle
false, // inheritCursor
false), // runAsComServer
true); // successful parse?
commandline = L"conhost.exe console --vtmode foo --outpipe foo -- bar";
ArgTestsRunner(L"#6 Check that a implicit commandline with other expected args is treated as a whole client commandline (4)",
commandline,
INVALID_HANDLE_VALUE,
INVALID_HANDLE_VALUE,
ConsoleArguments(commandline,
L"console --vtmode foo --outpipe foo -- bar", // clientCommandLine
INVALID_HANDLE_VALUE,
INVALID_HANDLE_VALUE,
L"", // vtMode
0, // width
0, // height
false, // forceV1
false, // forceNoHandoff
false, // headless
true, // createServerHandle
0, // serverHandle
0, // signalHandle
false, // inheritCursor
false), // runAsComServer
true); // successful parse?
commandline = L"conhost.exe --vtmode foo -- --outpipe foo bar";
ArgTestsRunner(L"#7 Check splitting vt pipes across the explicit commandline does not pull both pipe names out",
commandline,
INVALID_HANDLE_VALUE,
INVALID_HANDLE_VALUE,
ConsoleArguments(commandline,
L"--outpipe foo bar", // clientCommandLine
INVALID_HANDLE_VALUE,
INVALID_HANDLE_VALUE,
L"foo", // vtMode
0, // width
0, // height
false, // forceV1
false, // forceNoHandoff
false, // headless
true, // createServerHandle
0, // serverHandle
0, // signalHandle
false, // inheritCursor
false), // runAsComServer
true); // successful parse?
commandline = L"conhost.exe --vtmode -- --headless bar";
ArgTestsRunner(L"#8 Let -- be used as a value of a parameter",
commandline,
INVALID_HANDLE_VALUE,
INVALID_HANDLE_VALUE,
ConsoleArguments(commandline,
L"bar", // clientCommandLine
INVALID_HANDLE_VALUE,
INVALID_HANDLE_VALUE,
L"--", // vtMode
0, // width
0, // height
false, // forceV1
false, // forceNoHandoff
true, // headless
true, // createServerHandle
0, // serverHandle
0, // signalHandle
false, // inheritCursor
false), // runAsComServer
true); // successful parse?
commandline = L"conhost.exe --";
ArgTestsRunner(L"#9 -- by itself does nothing successfully",
commandline,
INVALID_HANDLE_VALUE,
INVALID_HANDLE_VALUE,
ConsoleArguments(commandline,
L"", // clientCommandLine
INVALID_HANDLE_VALUE,
INVALID_HANDLE_VALUE,
L"", // vtMode
0, // width
0, // height
false, // forceV1
false, // forceNoHandoff
false, // headless
true, // createServerHandle
0, // serverHandle
0, // signalHandle
false, // inheritCursor
false), // runAsComServer
true); // successful parse?
commandline = L"conhost.exe";
ArgTestsRunner(L"#10 An empty commandline should parse as an empty commandline",
commandline,
INVALID_HANDLE_VALUE,
INVALID_HANDLE_VALUE,
ConsoleArguments(commandline,
L"", // clientCommandLine
INVALID_HANDLE_VALUE,
INVALID_HANDLE_VALUE,
L"", // vtMode
0, // width
0, // height
false, // forceV1
false, // forceNoHandoff
false, // headless
true, // createServerHandle
0, // serverHandle
0, // signalHandle
false, // inheritCursor
false), // runAsComServer
true); // successful parse?
}