PowerShell/test/powershell/Tee-Object.Tests.ps1
Andrew Schwartzmeyer bbebf2f76a 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`
2016-01-14 17:00:06 -08:00

35 lines
1.3 KiB
PowerShell

$here = Split-Path -Parent $MyInvocation.MyCommand.Path
Describe "Tee-Object" {
Context "Validate Tee-Object is correctly forking output" {
It "Should return the output to the screen and to the variable" {
$teefile = "$here/assets/testfile.txt"
echo teeobjecttest1 | Tee-Object -variable teeresults
$teeresults | Should Be "teeobjecttest1"
Remove-Item $teefile -ErrorAction SilentlyContinue
}
It "Should return the output to the screen and to the variable from the alias" {
$teefile = "$here/assets/testfile.txt"
echo teeobjecttest2 | tee -variable teeresults
$teeresults | Should Be "teeobjecttest2"
Remove-Item $teefile -ErrorAction SilentlyContinue
}
It "Should tee the output to a file" {
$teefile = "$here/assets/testfile.txt"
echo teeobjecttest3 | Tee-Object $teefile
Get-Content $teefile | Should Be "teeobjecttest3"
Remove-Item $teefile -ErrorAction SilentlyContinue
}
It "Should tee the output to a file using the alias" {
$teefile = "$here/assets/testfile.txt"
echo teeobjecttest4 | tee $teefile
Get-Content $teefile | Should Be "teeobjecttest4"
Remove-item $teefile -ErrorAction SilentlyContinue
}
}
}