tests/functions/tabexpansion/input.Tests.ps1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
Describe 'Completion tests: input' { BeforeAll { function Complete { [CmdletBinding()] param ( [string] $Expression ) process { [System.Management.Automation.CommandCompletion]::CompleteInput( $Expression, $Expression.Length, $null ).CompletionMatches } } } It 'can complete input from Get-ChildItem' { (Complete -Expression 'Get-ChildItem | Select-PSFObject ').CompletionText | Should -Match '^Attributes$|^BaseName$|^CreationTime$|^CreationTimeUtc$|^Directory$|^DirectoryName$|^Exists$|^Extension$|^FullName$|^IsReadOnly$|^LastAccessTime$|^LastAccessTimeUtc$|^LastWriteTime$|^LastWriteTimeUtc$|^Length$|^Name$|^Parent$|^PSChildName$|^PSDrive$|^PSIsContainer$|^PSParentPath$|^PSPath$|^PSProvider$|^Root$|^VersionInfo$' (Complete -Expression 'Get-ChildItem | Select-PSFObject ').Count | Should -Be 25 } <# It 'can complete type name' { Complete 'Find-Type -Name Toke' | Should -All { $_.CompletionText.StartsWith('Token') } } It 'can complete type full names' { Complete 'Find-Member -ReturnType Ast' | Should -All { $_.CompletionText -match '\.Ast' } } It 'can complete namespace names' { Complete 'Find-Namespace Autom' | Should -HaveProperty CompletionText -WithValue Automation } It 'can complete namespaces' { Complete 'Find-Namespace -FullName Autom' | Should -HaveProperty CompletionText -WithValue System.Management.Automation } It 'can complete assembly names' { Complete 'Get-Assembly System.Management.Autom' | Should -HaveProperty CompletionText -WithValue System.Management.Automation } #> } |