Files
PowerShell-PowerShell/test/powershell/Modules/Microsoft.PowerShell.Utility/Get-Command.Tests.ps1
T
Steve Lee b87cd1c0a3 Add support to show suggestions on CommandNotFound exception (#8458)
* support fuzzy matching with get-command and on CommandNotFound exception, show suggestion
* fix CodeFactor issues
* change algorithm to use Damerau-Levenshtein Distance which is more useful in finding close matches
2019-01-10 13:35:30 -08:00

24 lines
763 B
PowerShell

# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
Describe "Get-Command CI tests" -Tag Feature {
Context "-UseFuzzyMatch tests" {
It "Should match cmdlets" {
$cmds = Get-Command get-hlp -UseFuzzyMatch
$cmds.Count | Should -BeGreaterThan 0
$cmds[0].Name | Should -BeExactly 'Get-Help' -Because "This should be closest match so shows up first"
}
It "Should match native commands" {
$ping = "ping"
if ($IsWindows) {
$ping = "PING.EXE"
}
$cmds = Get-Command pin -UseFuzzyMatch
$cmds.Count | Should -BeGreaterThan 0
$cmds.Name | Should -Contain $ping
}
}
}