diff --git a/test/powershell/Get-Content.Tests.ps1 b/test/powershell/Get-Content.Tests.ps1 index 29e38fa25..abcb0d089 100644 --- a/test/powershell/Get-Content.Tests.ps1 +++ b/test/powershell/Get-Content.Tests.ps1 @@ -18,6 +18,11 @@ New-Item -Path $testPath2 -ItemType file -Force -Value $testString2 } + AfterEach { + Remove-Item -Path $testPath -Force + Remove-Item -Path $testPath2 -Force + } + It "Should throw an error on a directory " { # also tests that -erroraction SilentlyContinue will work. Get-Content . -ErrorAction SilentlyContinue | Should Throw diff --git a/test/powershell/Get-ItemProperty.Tests.ps1 b/test/powershell/Get-ItemProperty.Tests.ps1 index 67592ef02..f991ef1f0 100644 --- a/test/powershell/Get-ItemProperty.Tests.ps1 +++ b/test/powershell/Get-ItemProperty.Tests.ps1 @@ -17,7 +17,7 @@ Describe "Get-ItemProperty" { } New-Item $tempDirectory -ItemType Directory -Force - $testfile = $tempDirectory + [Environment]::DirectorySeparatorChar + "testfile1" + $testfile = $tempDirectory + [System.IO.Path]::DirectorySeparatorChar + "testfile1" New-Item $testfile -ItemType file -Force @@ -62,4 +62,6 @@ Describe "Get-ItemProperty" { $alias.PSDrive | Should Be $cmdlet.PSDrive $alias.PSProvider.Name | Should Be $cmdlet.PSProvider.Name } + + Remove-Item $tempDirectory -Recurse -Force } diff --git a/test/powershell/Select-String.Tests.ps1 b/test/powershell/Select-String.Tests.ps1 index 7f4375e79..b6f5b9cc6 100644 --- a/test/powershell/Select-String.Tests.ps1 +++ b/test/powershell/Select-String.Tests.ps1 @@ -104,6 +104,10 @@ New-Item $testInputFile -Itemtype "file" -Force -Value "This is a text string, and another string${nl}This is the second line${nl}This is the third line${nl}This is the fourth line${nl}No matches" } + AfterEach { + Remove-Item $testInputFile -Force + } + It "Should return an object when a match is found is the file on only one line" { (Select-String $testInputFile -Pattern "string").GetType().BaseType | Should be System.Object } diff --git a/test/powershell/Start-Process.Tests.ps1 b/test/powershell/Start-Process.Tests.ps1 index 53bcffa0e..702211dc9 100644 --- a/test/powershell/Start-Process.Tests.ps1 +++ b/test/powershell/Start-Process.Tests.ps1 @@ -71,4 +71,6 @@ Describe "Start-Process" { $dirEntry = dir $tempFile $dirEntry.Length | Should BeGreaterThan 0 } + + Remove-Item -Path $tempFile -Force }