MegaBites-AI/Windows-powershell
0372
1# Copyright (c) Microsoft Corporation.2# Licensed under the MIT License.3Describe "Read-Host" -Tags "Slow","Feature" {4 Context "[Console]::ReadKey() implementation on non-Windows" {5 BeforeAll {6 $powershell = Join-Path -Path $PSHOME -ChildPath "pwsh"7 $assetsDir = Join-Path -Path $PSScriptRoot -ChildPath assets8 if ($IsWindows) {9 $ItArgs = @{ skip = $true }10 } elseif (-not (Get-Command expect -ErrorAction Ignore)) {11 $ItArgs = @{ pending = $true }12 } else {13 $ItArgs = @{ }14 }15 16 $expectFile = Join-Path $assetsDir "Read-Host.Output.expect"17 18 if (-not $IsWindows) {19 chmod a+x $expectFile20 }21 }22 23 It @ItArgs "Should output correctly" {24 & $expectFile $powershell | Out-Null25 $LASTEXITCODE | Should -Be 026 }27 }28}29 