Windows-powershell / PowerShell-master /test /powershell /Modules /Microsoft.PowerShell.Core /Out-Host.Tests.ps1
Download PowerShell-master/test/powershell/Modules/Microsoft.PowerShell.Core/Out-Host.Tests.ps1 from MegaBites-AI/Windows-powershell: direct link, hf CLI and curl.
- Browser
- Download file 824 Bytes
-
https://huggingface.co/datasets/MegaBites-AI/Windows-powershell/resolve/main/PowerShell-master/test/powershell/Modules/Microsoft.PowerShell.Core/Out-Host.Tests.ps1
- Command line
-
hf download hf://datasets/MegaBites-AI/Windows-powershell/PowerShell-master/test/powershell/Modules/Microsoft.PowerShell.Core/Out-Host.Tests.ps1
-
curl -L -o Out-Host.Tests.ps1 https://huggingface.co/datasets/MegaBites-AI/Windows-powershell/resolve/main/PowerShell-master/test/powershell/Modules/Microsoft.PowerShell.Core/Out-Host.Tests.ps1
824 Bytes
| # Copyright (c) Microsoft Corporation. | |
| # Licensed under the MIT License. | |
| Describe "Out-Host Tests" -Tag CI { | |
| BeforeAll { | |
| $th = New-TestHost | |
| $rs = [runspacefactory]::Createrunspace($th) | |
| $rs.open() | |
| $ps = [powershell]::Create() | |
| $ps.Runspace = $rs | |
| $ps.Commands.Clear() | |
| } | |
| AfterEach { | |
| $ps.Commands.Clear() | |
| } | |
| AfterAll { | |
| $rs.Close() | |
| $rs.Dispose() | |
| $ps.Dispose() | |
| } | |
| It "Out-Host writes to host output" { | |
| $stringToWrite = "thing to write" | |
| $stringExpected = "::$($stringToWrite):NewLine" | |
| $result = $ps.AddScript("Out-Host -inputobject '$stringToWrite'").Invoke() | |
| $th.UI.Streams.ConsoleOutput.Count | Should -Be 1 | |
| $th.UI.Streams.ConsoleOutput[0] | Should -BeExactly $stringExpected | |
| } | |
| } | |