mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Add error handling for interactive #requires (#6469)
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user