Add error handling for interactive #requires (#6469)

This commit is contained in:
Robert Holt
2018-04-25 18:04:04 -07:00
committed by Dongbo Wang
parent 4b149e4191
commit 63c0d8d783
4 changed files with 61 additions and 6 deletions
@@ -27,4 +27,21 @@ Describe "Requires tests" -Tags "CI" {
}
}
}
Context "Interactive requires" {
BeforeAll {
$ps = [powershell]::Create()
}
AfterAll {
$ps.Dispose()
}
It "Successfully does nothing when given '#requires' interactively" {
$settings = [System.Management.Automation.PSInvocationSettings]::new()
$settings.AddToHistory = $true
{ $ps.AddScript("#requires").Invoke(@(), $settings) } | Should -Not -Throw
}
}
}