Files
PowerShell/src/pester-tests/Test-Get-Content.Tests.ps1
T

30 lines
1.4 KiB
PowerShell
Raw Normal View History

2015-07-15 10:15:39 -07:00
Describe "Test-Get-Content" {
It "Should throw an error on a directory " {
# also tests that -erroraction SilentlyContinue will work.
2015-07-15 16:27:53 -07:00
Get-Content . -ErrorAction SilentlyContinue | Should Throw
cat . -ErrorAction SilentlyContinue | Should Throw
gc . -ErrorAction SilentlyContinue | Should Throw
2015-07-15 16:30:20 -07:00
type . -ErrorAction SilentlyContinue | Should Throw
2015-07-15 10:15:39 -07:00
}
It "Should deliver an array object when listing a file" {
(Get-Content -Path .\Test-Get-Content.Tests.ps1).GetType().BaseType.Name | Should Be "Array"
2015-07-15 16:27:53 -07:00
(Get-Content -Path .\Test-Get-Content.Tests.ps1)[0] |Should be "`$here = Split-Path -Parent `$MyInvocation.MyCommand.Path"
(gc -Path .\Test-Get-Content.Tests.ps1).GetType().BaseType.Name | Should Be "Array"
(gc -Path .\Test-Get-Content.Tests.ps1)[0] |Should be "`$here = Split-Path -Parent `$MyInvocation.MyCommand.Path"
(type -Path .\Test-Get-Content.Tests.ps1).GetType().BaseType.Name | Should Be "Array"
(type -Path .\Test-Get-Content.Tests.ps1)[0] |Should be "`$here = Split-Path -Parent `$MyInvocation.MyCommand.Path"
(cat -Path .\Test-Get-Content.Tests.ps1).GetType().BaseType.Name | Should Be "Array"
(cat -Path .\Test-Get-Content.Tests.ps1)[0] |Should be "`$here = Split-Path -Parent `$MyInvocation.MyCommand.Path"
2015-07-15 10:15:39 -07:00
}
2015-07-15 16:27:53 -07:00
}