mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Update Get-Error test to not depend on DNS APIs (#17471)
This commit is contained in:
@@ -107,23 +107,15 @@ Describe 'Get-Error tests' -Tag CI {
|
||||
}
|
||||
|
||||
It 'Get-Error adds ExceptionType for Exceptions' {
|
||||
|
||||
try {
|
||||
[System.Net.DNS]::GetHostByName((New-Guid))
|
||||
throw [ArgumentException] 'myexception'
|
||||
}
|
||||
catch {
|
||||
}
|
||||
|
||||
$out = Get-Error | Out-String
|
||||
$out | Should -BeLikeExactly '*Type*'
|
||||
|
||||
if ($IsWindows) {
|
||||
$expectedExceptionType = "System.Management.Automation.ParentContainsErrorRecordException"
|
||||
}
|
||||
else {
|
||||
$expectedExceptionType = "System.Net.Internals.SocketExceptionFactory+ExtendedSocketException"
|
||||
}
|
||||
|
||||
$out | Should -BeLikeExactly "*$expectedExceptionType*"
|
||||
$out | Should -Match "Type\s+:\s(.\[\d+m)?System.ArgumentException"
|
||||
}
|
||||
|
||||
It 'Get-Error uses Error color for Message and PositionMessage members' {
|
||||
|
||||
Reference in New Issue
Block a user