mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Added pester tests for Tee-Object
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
$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
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user