mirror of
https://github.com/NixOS/nix
synced 2025-07-07 14:21:48 +02:00
Implement tests for lookupPathForProgram and fix bugs caught by tests
This commit is contained in:
parent
d7537f6955
commit
4f6e3b9402
2 changed files with 13 additions and 5 deletions
|
@ -6,11 +6,19 @@ namespace nix {
|
|||
/*
|
||||
TEST(SpawnTest, spawnEcho)
|
||||
{
|
||||
auto output = runProgram(RunOptions{.program = "echo", .args = {}});
|
||||
auto output = runProgram(RunOptions{.program = "cmd", .lookupPath = true, .args = {"/C", "echo \"hello world\""}});
|
||||
std::cout << output.second << std::endl;
|
||||
}
|
||||
*/
|
||||
|
||||
#ifdef _WIN32
|
||||
Path lookupPathForProgram(const Path & program);
|
||||
TEST(SpawnTest, pathSearch)
|
||||
{
|
||||
ASSERT_NO_THROW(lookupPathForProgram("cmd"));
|
||||
ASSERT_NO_THROW(lookupPathForProgram("cmd.exe"));
|
||||
ASSERT_THROW(lookupPathForProgram("C:/System32/cmd.exe"), UsageError);
|
||||
}
|
||||
std::string windowsEscape(const std::string & str, bool cmd);
|
||||
|
||||
TEST(SpawnTest, windowsEscape)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue