Add -PassThru parameter to Set-Clipboard (#13713)

This commit is contained in:
Thomas Nieto
2021-07-22 10:17:53 -07:00
committed by GitHub
parent 0002f7e8be
commit 7777afc005
2 changed files with 43 additions and 0 deletions
@@ -51,5 +51,36 @@ Describe 'Clipboard cmdlet tests' -Tag CI {
$text | Set-Clipboard
Get-Clipboard -Raw | Should -BeNullOrEmpty
}
It 'Set-Clipboard should not return object' {
$result = 'hello' | Set-Clipboard
$result | Should -BeNullOrEmpty
}
It 'Set-Clipboard -PassThru returns single object with -Append = <Append>' -TestCases @(
@{ Append = $false }
@{ Append = $true }
){
param ($append)
$params = @{ PassThru = $true; Append = $append }
Set-Clipboard -Value 'world'
$result = 'hello' | Set-Clipboard @params
$result | Should -BeExactly 'hello'
}
It 'Set-Clipboard -PassThru returns multiple objects with -Append = <Append>' -TestCases @(
@{ Append = $false }
@{ Append = $true }
){
param ($append)
$params = @{ PassThru = $true; Append = $append }
Set-Clipboard -Value 'world'
$result = 'hello', 'world' | Set-Clipboard @params
$result | Should -BeExactly @('hello', 'world')
}
}
}