mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Add test for -EncodedCommand
This commit is contained in:
@@ -8,5 +8,14 @@ Describe "CoreConsoleHost unit tests" {
|
||||
& $powershell -noprofile $x | ?{ $_ -match "usage: powershell" } | Should Not BeNullOrEmpty
|
||||
}
|
||||
}
|
||||
|
||||
It "Should accept a Base64 encoded command" {
|
||||
$commandString = "Get-Location"
|
||||
$encodedCommand = [System.Convert]::ToBase64String([System.Text.Encoding]::Unicode.GetBytes($commandString))
|
||||
# We don't compare to `Get-Location` directly because object and formatted output comparisons are difficult
|
||||
$expected = & $powershell -noprofile -command $commandString
|
||||
$actual = & $powershell -noprofile -EncodedCommand $encodedCommand
|
||||
$actual | Should Be $expected
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user