|
| 1 | +New-Item -Path 'foo[1].txt' -Force |
| 2 | + |
| 3 | +. $PSScriptRoot\PathProcessingNonExistingPaths.ps1 |
| 4 | +Describe 'Verify Path Processing for Non-existing Paths Allowed Impl' { |
| 5 | + It 'Processes non-wildcard absolute path to non-existing file via -Path param' { |
| 6 | + New-File -Path $PSScriptRoot\ReadmeNew.md | Should Be "$PSScriptRoot\READMENew.md" |
| 7 | + } |
| 8 | + It 'Processes multiple absolute paths via -Path param' { |
| 9 | + New-File -Path $PSScriptRoot\Readme.md, $PSScriptRoot\XYZZY.ps1 | |
| 10 | + Should Be @("$PSScriptRoot\README.md", "$PSScriptRoot\XYZZY.ps1") |
| 11 | + } |
| 12 | + It 'Processes relative path via -Path param' { |
| 13 | + New-File -Path ..\examples\READMENew.md | Should Be "$PSScriptRoot\READMENew.md" |
| 14 | + } |
| 15 | + It 'Processes multiple relative path via -Path param' { |
| 16 | + New-File -Path ..\examples\README.md, XYZZY.ps1 | |
| 17 | + Should Be @("$PSScriptRoot\README.md", "$PSScriptRoot\XYZZY.ps1") |
| 18 | + } |
| 19 | + |
| 20 | + It 'Should accept pipeline input to Path' { |
| 21 | + Get-ChildItem -LiteralPath "$pwd\foo[1].txt" | New-File | Should Be "$PSScriptRoot\foo[1].txt" |
| 22 | + } |
| 23 | +} |
| 24 | + |
| 25 | +. $PSScriptRoot\PathProcessingNoWildcards.ps1 |
| 26 | +Describe 'Verify Path Processing for NO Wildcards Allowed Impl' { |
| 27 | + It 'Processes non-wildcard absolute path via -Path param' { |
| 28 | + Import-FileNoWildcard -Path $PSScriptRoot\Readme.md | Should Be "$PSScriptRoot\README.md" |
| 29 | + } |
| 30 | + It 'Processes multiple absolute paths via -Path param' { |
| 31 | + Import-FileNoWildcard -Path $PSScriptRoot\Readme.md, $PSScriptRoot\PathProcessingWildcards.ps1 | |
| 32 | + Should Be @("$PSScriptRoot\README.md", "$PSScriptRoot\PathProcessingWildcards.ps1") |
| 33 | + } |
| 34 | + It 'Processes relative path via -Path param' { |
| 35 | + Import-FileNoWildcard -Path ..\examples\README.md | Should Be "$PSScriptRoot\README.md" |
| 36 | + } |
| 37 | + It 'Processes multiple relative path via -Path param' { |
| 38 | + Import-FileNoWildcard -Path ..\examples\README.md, .vscode\launch.json | |
| 39 | + Should Be @("$PSScriptRoot\README.md", "$PSScriptRoot\.vscode\launch.json") |
| 40 | + } |
| 41 | + |
| 42 | + It 'Should accept pipeline input to Path' { |
| 43 | + Get-ChildItem -LiteralPath "$pwd\foo[1].txt" | Import-FileNoWildcard | Should Be "$PSScriptRoot\foo[1].txt" |
| 44 | + } |
| 45 | +} |
| 46 | + |
| 47 | +. $PSScriptRoot\PathProcessingWildcards.ps1 |
| 48 | +Describe 'Verify Path Processing for Wildcards Allowed Impl' { |
| 49 | + It 'Processes non-wildcard absolute path via -Path param' { |
| 50 | + Import-FileWildcard -Path $PSScriptRoot\Readme.md | Should Be "$PSScriptRoot\README.md" |
| 51 | + } |
| 52 | + It 'Processes multiple absolute paths via -Path param' { |
| 53 | + Import-FileWildcard -Path $PSScriptRoot\Readme.md, $PSScriptRoot\PathProcessingWildcards.ps1 | |
| 54 | + Should Be @("$PSScriptRoot\README.md", "$PSScriptRoot\PathProcessingWildcards.ps1") |
| 55 | + } |
| 56 | + It 'Processes wildcard absolute path via -Path param' { |
| 57 | + Import-FileWildcard -Path $PSScriptRoot\*.md | Should Be "$PSScriptRoot\README.md" |
| 58 | + } |
| 59 | + It 'Processes wildcard relative path via -Path param' { |
| 60 | + Import-FileWildcard -Path *.md | Should Be "$PSScriptRoot\README.md" |
| 61 | + } |
| 62 | + It 'Processes relative path via -Path param' { |
| 63 | + Import-FileWildcard -Path ..\examples\README.md | Should Be "$PSScriptRoot\README.md" |
| 64 | + } |
| 65 | + It 'Processes multiple relative path via -Path param' { |
| 66 | + Import-FileWildcard -Path ..\examples\README.md, .vscode\launch.json | |
| 67 | + Should Be @("$PSScriptRoot\README.md", "$PSScriptRoot\.vscode\launch.json") |
| 68 | + } |
| 69 | + |
| 70 | + It 'DefaultParameterSet should be Path' { |
| 71 | + Import-FileWildcard *.md | Should Be "$PSScriptRoot\README.md" |
| 72 | + } |
| 73 | + |
| 74 | + It 'Should process absolute literal paths via -LiteralPath param'{ |
| 75 | + Import-FileWildcard -LiteralPath "$PSScriptRoot\foo[1].txt" | Should Be "$PSScriptRoot\foo[1].txt" |
| 76 | + } |
| 77 | + It 'Should process relative literal paths via -LiteralPath param'{ |
| 78 | + Import-FileWildcard -LiteralPath "..\examples\foo[1].txt" | Should Be "$PSScriptRoot\foo[1].txt" |
| 79 | + } |
| 80 | + It 'Should process multiple literal paths via -LiteralPath param'{ |
| 81 | + Import-FileWildcard -LiteralPath "..\examples\foo[1].txt", "$PSScriptRoot\README.md" | |
| 82 | + Should Be @("$PSScriptRoot\foo[1].txt", "$PSScriptRoot\README.md") |
| 83 | + } |
| 84 | + |
| 85 | + It 'Should accept pipeline input to LiteralPath' { |
| 86 | + Get-ChildItem -LiteralPath "$pwd\foo[1].txt" | Import-FileWildcard | Should Be "$PSScriptRoot\foo[1].txt" |
| 87 | + } |
| 88 | +} |
0 commit comments