From b2c004007078f975bef865d23856f3fa736d0fa3 Mon Sep 17 00:00:00 2001 From: sethvs Date: Sun, 8 Apr 2018 15:16:10 +0300 Subject: [PATCH] Fix formatting. --- .../Convert-Path.Tests.ps1 | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/test/powershell/Modules/Microsoft.PowerShell.Management/Convert-Path.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Management/Convert-Path.Tests.ps1 index f6358ee89ec..6205d70229a 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Management/Convert-Path.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Management/Convert-Path.Tests.ps1 @@ -2,35 +2,43 @@ # Licensed under the MIT License. Describe "Convert-Path tests" -Tag CI { It "Convert-Path should handle provider qualified paths" { - Convert-Path "FileSystem::${TESTDRIVE}" | Should -BeExactly "${TESTDRIVE}" + Convert-Path -Path "FileSystem::${TestDrive}" | Should -BeExactly "${TestDrive}" } + It "Convert-Path should return the proper path" { - Convert-Path "$TESTDRIVE" | Should -BeExactly "$TESTDRIVE" + Convert-Path -Path "$TestDrive" | Should -BeExactly "$TestDrive" } + It "Convert-Path supports pipelined input" { - "$TESTDRIVE" | Convert-Path | Should -BeExactly "$TESTDRIVE" + "$TestDrive" | Convert-Path | Should -BeExactly "$TestDrive" } + It "Convert-Path supports pipelined input by property name" { - get-item $TESTDRIVE | Convert-Path | Should -BeExactly "$TESTDRIVE" + Get-Item -Path $TestDrive | Convert-Path | Should -BeExactly "$TestDrive" } + It "Convert-Path without arguments is an error" { $ps = [powershell]::Create() { $ps.AddCommand("Convert-Path").Invoke() } | Should -Throw -ErrorId "ParameterBindingException" } + It "Convert-Path with null path is an error" { - { Convert-Path -path "" } | Should -Throw -ErrorId "ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.PowerShell.Commands.ConvertPathCommand" + { Convert-Path -Path "" } | Should -Throw -ErrorId "ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.PowerShell.Commands.ConvertPathCommand" } + It "Convert-Path with non-existing non-filesystem path is an error" { - { Convert-Path -path "env:thisvariableshouldnotexist" -ErrorAction Stop } | Should -Throw -ErrorId "PathNotFound,Microsoft.PowerShell.Commands.ConvertPathCommand" + { Convert-Path -Path "env:thisvariableshouldnotexist" -ErrorAction Stop } | Should -Throw -ErrorId "PathNotFound,Microsoft.PowerShell.Commands.ConvertPathCommand" } + It "Convert-Path can handle multiple directories" { - $d1 = Setup -D dir1 -pass - $d2 = Setup -D dir2 -pass - $result = convert-path "${TESTDRIVE}/dir?" + $d1 = Setup -Dir -Path dir1 -PassThru + $d2 = Setup -Dir -Path dir2 -PassThru + $result = Convert-Path -Path "${TestDrive}/dir?" $result.count | Should -Be 2 $result -join "," | Should -BeExactly (@("$d1","$d2") -join ",") } + It "Convert-Path should return something which exists" { - Convert-Path $TESTDRIVE | Should -Exist + Convert-Path -Path $TestDrive | Should -Exist } }