more tests

This commit is contained in:
Mike Griese 2021-11-15 11:22:41 -06:00
parent fd72b7992e
commit 8e43c9d8ce
2 changed files with 21 additions and 4 deletions

View file

@ -44,7 +44,7 @@
<ClCompile Include="SettingsTests.cpp" />
<ClCompile Include="TabTests.cpp" />
<ClCompile Include="TrustCommandlineTests.cpp" />
<ClCompile Include="FilteredCommandTests.cpp" />
<ClCompile Include="FilteredCommandTests.cpp" />
<ClCompile Include="pch.cpp">
<PrecompiledHeader>Create</PrecompiledHeader>
</ClCompile>

View file

@ -39,6 +39,7 @@ namespace TerminalAppLocalTests
TEST_METHOD(SimpleTests);
TEST_METHOD(TestCommandlineWithArgs);
TEST_METHOD(TestCommandlineWithSpaces);
TEST_METHOD(TestCommandlineWithEnvVars);
TEST_METHOD(WslTests);
TEST_METHOD(TestPwshLocation);
@ -68,14 +69,30 @@ namespace TerminalAppLocalTests
void TrustCommandlineTests::TestCommandlineWithSpaces()
{
VERIFY_IS_TRUE(false, L"TODO! implement me.");
VERIFY_IS_TRUE(trust(L"C:\\Program Files\\PowerShell\\7\\pwsh.exe"));
VERIFY_IS_FALSE(trust(L"C:\\Windows\\System 32\\cmd.exe"));
VERIFY_IS_FALSE(trust(L"C:\\Windows\\System32\\ cmd.exe"));
VERIFY_IS_FALSE(trust(L"C:\\Windows\\System32\\cmd.exe /c cmd.exe"));
}
void TrustCommandlineTests::TestCommandlineWithEnvVars()
{
VERIFY_IS_TRUE(trust(L"%WINDIR%\\system32\\cmd.exe"));
VERIFY_IS_TRUE(trust(L"%WINDIR%\\system32\\WindowsPowerShell\\v1.0\\powershell.exe"));
VERIFY_IS_TRUE(trust(L"%ProgramFiles%\\PowerShell\\7\\pwsh.exe"));
}
void TrustCommandlineTests::WslTests()
{
VERIFY_IS_TRUE(false, L"TODO! implement me.");
VERIFY_IS_FALSE(trust(L"C:\\Windows\\System32\\wsl"));
VERIFY_IS_FALSE(trust(L"C:\\Windows\\System32\\wsl.exe"));
VERIFY_IS_FALSE(trust(L"C:\\Windows\\System32\\wsl.exe -d Ubuntu"));
VERIFY_IS_FALSE(trust(L"wsl.exe"));
}
void TrustCommandlineTests::TestPwshLocation()
{
VERIFY_IS_TRUE(false, L"TODO! implement me.");
VERIFY_IS_TRUE(trust(L"%ProgramFiles%\\PowerShell\\7\\pwsh.exe"));
VERIFY_IS_TRUE(trust(L"%LOCALAPPDATA%\\Microsoft\\WindowsApps\\pwsh.exe"));
}
}