mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-17 12:45:47 +00:00
Reorganize tests
- Pester source code moved to `test/Pester`, deleted `ext-src`. - Pester tests (.ps1 files) moved to `test/powershell` - xUnit tests (.cs files) moved to `test/csharp` - Third-party script test moved to `test/shebang`
This commit is contained in:
1 parent
ec08d9f46c
commit
bbebf2f76a
105 files changed
+1
-1
No files matched your search
@@ -0,0 +1,74 @@
|
||||
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||
. $here/Test-Common.ps1
|
||||
|
||||
Describe "Start-Process" {
|
||||
$pingCommand = (Get-Command -CommandType Application ping)[0].Definition
|
||||
$pingDirectory = Split-Path $pingCommand -Parent
|
||||
$tempFile = "$(GetTempDir)/PSTest"
|
||||
$assetsFile = $here + "/assets/SortTest.txt"
|
||||
$windows = IsWindows
|
||||
if ($windows)
|
||||
{
|
||||
$pingParam = "localhost -n 4"
|
||||
}
|
||||
else
|
||||
{
|
||||
$pingParam = "localhost -c 4"
|
||||
}
|
||||
|
||||
It "Should process arguments without error" {
|
||||
$process = Start-Process ping -ArgumentList $pingParam -PassThru
|
||||
|
||||
$process.Length | Should Be 1
|
||||
$process.Id | Should BeGreaterThan 1
|
||||
$process.ProcessName | Should Be "ping"
|
||||
}
|
||||
|
||||
It "Should work correctly when used with full path name" {
|
||||
$process = Start-Process $pingCommand -ArgumentList $pingParam -PassThru
|
||||
|
||||
$process.Length | Should Be 1
|
||||
$process.Id | Should BeGreaterThan 1
|
||||
$process.ProcessName | Should Be "ping"
|
||||
}
|
||||
|
||||
It "Should invoke correct path when used with FilePath argument" {
|
||||
$process = Start-Process -FilePath $pingCommand -ArgumentList $pingParam -PassThru
|
||||
|
||||
$process.Length | Should Be 1
|
||||
$process.Id | Should BeGreaterThan 1
|
||||
$process.ProcessName | Should Be "ping"
|
||||
}
|
||||
|
||||
It "Should wait for command completion if used with Wait argument" {
|
||||
$process = Start-Process ping -ArgumentList $pingParam -Wait -PassThru
|
||||
}
|
||||
|
||||
It "Should work correctly with WorkingDirectory argument" {
|
||||
$process = Start-Process ping -WorkingDirectory $pingDirectory -ArgumentList $pingParam -PassThru
|
||||
|
||||
$process.Length | Should Be 1
|
||||
$process.Id | Should BeGreaterThan 1
|
||||
$process.ProcessName | Should Be "ping"
|
||||
}
|
||||
|
||||
It "Should should handle stderr redirection without error" {
|
||||
$process = Start-Process ping -ArgumentList $pingParam -PassThru -RedirectStandardError $tempFile
|
||||
|
||||
$process.Length | Should Be 1
|
||||
$process.Id | Should BeGreaterThan 1
|
||||
$process.ProcessName | Should Be "ping"
|
||||
}
|
||||
|
||||
It "Should should handle stdout redirection without error" {
|
||||
$process = Start-Process ping -ArgumentList $pingParam -Wait -RedirectStandardOutput $tempFile
|
||||
$dirEntry = dir $tempFile
|
||||
$dirEntry.Length | Should BeGreaterThan 0
|
||||
}
|
||||
|
||||
It "Should should handle stdin redirection without error" {
|
||||
$process = Start-Process sort -Wait -RedirectStandardOutput $tempFile -RedirectStandardInput $assetsFile
|
||||
$dirEntry = dir $tempFile
|
||||
$dirEntry.Length | Should BeGreaterThan 0
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user