File size: 933 Bytes
8c763fb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
Describe "Read-Host" -Tags "Slow","Feature" {
    Context "[Console]::ReadKey() implementation on non-Windows" {
        BeforeAll {
            $powershell = Join-Path -Path $PSHOME -ChildPath "pwsh"
            $assetsDir = Join-Path -Path $PSScriptRoot -ChildPath assets
            if ($IsWindows) {
                $ItArgs = @{ skip = $true }
            } elseif (-not (Get-Command expect -ErrorAction Ignore)) {
                $ItArgs = @{ pending = $true }
            } else {
                $ItArgs = @{ }
            }

            $expectFile = Join-Path $assetsDir "Read-Host.Output.expect"

            if (-not $IsWindows) {
                chmod a+x $expectFile
            }
        }

        It @ItArgs "Should output correctly" {
            & $expectFile $powershell | Out-Null
            $LASTEXITCODE | Should -Be 0
        }
    }
}