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

26 lines
1.3 KiB
PowerShell
Raw Normal View History

Describe "Test-Get-Content" {
2015-07-15 10:15:39 -07:00
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"
(Get-Content -Path ./Test-Get-Content.Tests.ps1)[0] |Should be "Describe `"Test-Get-Content`" `{"
2015-07-15 16:27:53 -07:00
(gc -Path ./Test-Get-Content.Tests.ps1).GetType().BaseType.Name | Should Be "Array"
(gc -Path ./Test-Get-Content.Tests.ps1)[0] |Should be "Describe `"Test-Get-Content`" `{"
2015-07-15 16:27:53 -07:00
(type -Path ./Test-Get-Content.Tests.ps1).GetType().BaseType.Name | Should Be "Array"
(type -Path ./Test-Get-Content.Tests.ps1)[0] |Should be "Describe `"Test-Get-Content`" `{"
2015-07-15 16:27:53 -07:00
(cat -Path ./Test-Get-Content.Tests.ps1).GetType().BaseType.Name | Should Be "Array"
(cat -Path ./Test-Get-Content.Tests.ps1)[0] |Should be "Describe `"Test-Get-Content`" `{"
2015-07-15 10:15:39 -07:00
}
2015-07-15 16:27:53 -07:00
}