mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Add -PassThru parameter to Set-Clipboard (#13713)
This commit is contained in:
@@ -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')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user