Ignore Remove-Item errors in Split-Path setup
This commit is contained in:
parent
7b1280eb2e
commit
92cd86d3f2
1 changed files with 8 additions and 6 deletions
|
@ -21,20 +21,22 @@
|
|||
Split-Path "abadTest" -Qualifier -ErrorAction SilentlyContinue | Should Throw
|
||||
}
|
||||
|
||||
It "Should return the path when the noqualifier switch is used on a linux system" {
|
||||
It "Should return the path when the noqualifier switch is used on a Linux system" {
|
||||
{ Split-Path /usr/bin -NoQualifier } | Should Not Throw
|
||||
Split-Path /usr/bin -NoQualifier | Should Be "/usr/bin"
|
||||
}
|
||||
|
||||
It "Should return the parent folder name when the leaf switch is used" {
|
||||
It "Should return the base name when the leaf switch is used" {
|
||||
Split-Path /usr/bin -Leaf | Should be "bin"
|
||||
Split-Path /usr/local/bin -Leaf | Should be "bin"
|
||||
Split-Path usr/bin -Leaf | Should be "bin"
|
||||
Split-Path ./bin -Leaf | Should be "bin"
|
||||
Split-Path bin -Leaf | Should be "bin"
|
||||
}
|
||||
|
||||
It "Should be able to accept regular expression input and output an array for multiple objects" {
|
||||
$testDir = "./tmp"
|
||||
Remove-Item $testDir -Recurse -Force
|
||||
Remove-Item $testDir -Recurse -Force -ErrorAction Ignore
|
||||
|
||||
$testFile1 = "testfile1.ps1"
|
||||
$testFile2 = "testfile2.ps1"
|
||||
|
@ -51,7 +53,7 @@
|
|||
$actual[0] | Should Be $testFile1
|
||||
$actual[1] | Should Be $testFile2
|
||||
|
||||
Remove-Item $testDir -Recurse -Force
|
||||
Remove-Item $testDir -Recurse -Force -ErrorAction Ignore
|
||||
Test-Path $testDir | Should Be $false
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue