|
2 | 2 | # Licensed under the MIT License.
|
3 | 3 | Describe "Convert-Path tests" -Tag CI {
|
4 | 4 | It "Convert-Path should handle provider qualified paths" {
|
5 |
| - Convert-Path "FileSystem::${TESTDRIVE}" | Should -BeExactly "${TESTDRIVE}" |
| 5 | + Convert-Path -Path "FileSystem::${TestDrive}" | Should -BeExactly "${TestDrive}" |
6 | 6 | }
|
| 7 | + |
7 | 8 | It "Convert-Path should return the proper path" {
|
8 |
| - Convert-Path "$TESTDRIVE" | Should -BeExactly "$TESTDRIVE" |
| 9 | + Convert-Path -Path "$TestDrive" | Should -BeExactly "$TestDrive" |
9 | 10 | }
|
| 11 | + |
10 | 12 | It "Convert-Path supports pipelined input" {
|
11 |
| - "$TESTDRIVE" | Convert-Path | Should -BeExactly "$TESTDRIVE" |
| 13 | + "$TestDrive" | Convert-Path | Should -BeExactly "$TestDrive" |
12 | 14 | }
|
| 15 | + |
13 | 16 | It "Convert-Path supports pipelined input by property name" {
|
14 |
| - get-item $TESTDRIVE | Convert-Path | Should -BeExactly "$TESTDRIVE" |
| 17 | + Get-Item -Path $TestDrive | Convert-Path | Should -BeExactly "$TestDrive" |
15 | 18 | }
|
| 19 | + |
16 | 20 | It "Convert-Path without arguments is an error" {
|
17 | 21 | $ps = [powershell]::Create()
|
18 | 22 | { $ps.AddCommand("Convert-Path").Invoke() } | Should -Throw -ErrorId "ParameterBindingException"
|
19 | 23 | }
|
| 24 | + |
20 | 25 | It "Convert-Path with null path is an error" {
|
21 |
| - { Convert-Path -path "" } | Should -Throw -ErrorId "ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.PowerShell.Commands.ConvertPathCommand" |
| 26 | + { Convert-Path -Path "" } | Should -Throw -ErrorId "ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.PowerShell.Commands.ConvertPathCommand" |
22 | 27 | }
|
| 28 | + |
23 | 29 | It "Convert-Path with non-existing non-filesystem path is an error" {
|
24 |
| - { Convert-Path -path "env:thisvariableshouldnotexist" -ErrorAction Stop } | Should -Throw -ErrorId "PathNotFound,Microsoft.PowerShell.Commands.ConvertPathCommand" |
| 30 | + { Convert-Path -Path "env:thisvariableshouldnotexist" -ErrorAction Stop } | Should -Throw -ErrorId "PathNotFound,Microsoft.PowerShell.Commands.ConvertPathCommand" |
25 | 31 | }
|
| 32 | + |
26 | 33 | It "Convert-Path can handle multiple directories" {
|
27 |
| - $d1 = Setup -D dir1 -pass |
28 |
| - $d2 = Setup -D dir2 -pass |
29 |
| - $result = convert-path "${TESTDRIVE}/dir?" |
| 34 | + $d1 = Setup -Dir -Path dir1 -PassThru |
| 35 | + $d2 = Setup -Dir -Path dir2 -PassThru |
| 36 | + $result = Convert-Path -Path "${TestDrive}/dir?" |
30 | 37 | $result.count | Should -Be 2
|
31 | 38 | $result -join "," | Should -BeExactly (@("$d1","$d2") -join ",")
|
32 | 39 | }
|
| 40 | + |
33 | 41 | It "Convert-Path should return something which exists" {
|
34 |
| - Convert-Path $TESTDRIVE | Should -Exist |
| 42 | + Convert-Path -Path $TestDrive | Should -Exist |
35 | 43 | }
|
36 | 44 | }
|
0 commit comments