Make sure we always return an object in command searcher (#9623)
This commit is contained in:
parent
94c1098e16
commit
1d94e8c947
|
@ -565,7 +565,7 @@ namespace System.Management.Automation
|
|||
}
|
||||
|
||||
provider = null;
|
||||
return null;
|
||||
return new Collection<string>();
|
||||
}
|
||||
|
||||
private static bool checkPath(string path, string commandName)
|
||||
|
|
|
@ -205,4 +205,10 @@ Describe "Command Discovery tests" -Tags "CI" {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
Context "error cases" {
|
||||
It 'Get-Command "less `"-PsPage %db?B of %DoesNotExist:`"" should throw Drive not found' {
|
||||
{Get-Command -Name "less `"-PsPage %db?B of %DoesNotExist:`""} | Should -Throw -ErrorId 'DriveNotFound' -Because "The drive 'DoesNotExist:' should not exist"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue