|
| 1 | +if (Get-Command -Name rustup -ErrorAction Stop) { |
| 2 | + # Enable rustup tab completion |
| 3 | + rustup completions powershell | Out-String | Invoke-Expression |
| 4 | +} |
| 5 | + |
| 6 | +function Get-Result([string]$Text, [int]$CursorPosition = $Text.Length, [hashtable]$Options) { |
| 7 | + [System.Management.Automation.CommandCompletion]::CompleteInput($Text, $CursorPosition, $Options).CompletionMatches |
| 8 | +} |
| 9 | + |
| 10 | +Describe 'rustup flags and subcommands' { |
| 11 | + $result = Get-Result 'rustup ' |
| 12 | + $result.Count | Should Be 23 |
| 13 | + $result[00].CompletionText | Should Be 'completions' |
| 14 | + $result[01].CompletionText | Should Be 'component' |
| 15 | + $result[02].CompletionText | Should Be 'default' |
| 16 | + $result[03].CompletionText | Should Be 'doc' |
| 17 | + $result[04].CompletionText | Should Be '-h' |
| 18 | + $result[05].CompletionText | Should Be 'help' |
| 19 | + $result[06].CompletionText | Should Be '--help' |
| 20 | + $result[07].CompletionText | Should Be 'install' |
| 21 | + $result[08].CompletionText | Should Be 'override' |
| 22 | + $result[09].CompletionText | Should Be 'run' |
| 23 | + $result[10].CompletionText | Should Be 'self' |
| 24 | + $result[11].CompletionText | Should Be 'set' |
| 25 | + $result[12].CompletionText | Should Be 'show' |
| 26 | + $result[13].CompletionText | Should Be 'target' |
| 27 | + $result[14].CompletionText | Should Be 'telemetry' |
| 28 | + $result[15].CompletionText | Should Be 'toolchain' |
| 29 | + $result[16].CompletionText | Should Be 'uninstall' |
| 30 | + $result[17].CompletionText | Should Be 'update' |
| 31 | + $result[18].CompletionText | Should Be '-V' |
| 32 | + $result[19].CompletionText | Should Be '-v' |
| 33 | + $result[20].CompletionText | Should Be '--verbose' |
| 34 | + $result[21].CompletionText | Should Be '--version' |
| 35 | + $result[22].CompletionText | Should Be 'which' |
| 36 | +} |
0 commit comments