2015-10-23 10:01:44 -07:00
|
|
|
Describe "Set-Location" {
|
|
|
|
|
It "Should be able to be called without error" {
|
|
|
|
|
{ Set-Location / } | Should Not Throw
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
It "Should be able to be called on different providers" {
|
|
|
|
|
{ Set-Location alias: } | Should Not Throw
|
|
|
|
|
{ Set-Location env: } | Should Not Throw
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
It "Should be able use the cd alias without error" {
|
|
|
|
|
{ cd / } | Should Not Throw
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
It "Should be able to use the chdir alias without error" {
|
|
|
|
|
{ chdir / } | Should Not Throw
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
It "Should be able to use the sl alias without error" {
|
|
|
|
|
{ sl / } | Should Not Throw
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Context "Functionality testing" {
|
2015-10-23 12:17:35 -07:00
|
|
|
$startDirectory = "$env:HOME/src/pester-tests"
|
2015-10-23 10:01:44 -07:00
|
|
|
|
|
|
|
|
It "Should have the correct current location when using the set-location cmdlet" {
|
|
|
|
|
Set-Location $startDirectory
|
|
|
|
|
|
|
|
|
|
$(Get-Location).Path | Should Be $startDirectory
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
It "Should have the correct current location when using the cd alias" {
|
|
|
|
|
cd /
|
|
|
|
|
|
2015-10-23 12:07:49 -07:00
|
|
|
$(Get-Location).Path | Should Be /
|
2015-10-23 10:01:44 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
It "Should have the correct current location when using the chdir alias" {
|
|
|
|
|
chdir /
|
|
|
|
|
|
2015-10-23 12:07:49 -07:00
|
|
|
$(Get-Location).Path | Should Be /
|
2015-10-23 10:01:44 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
It "Should have the correct current location when using the chdir alias" {
|
|
|
|
|
sl /
|
|
|
|
|
|
2015-10-23 12:07:49 -07:00
|
|
|
$(Get-Location).Path | Should Be /
|
2015-10-23 10:01:44 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
It "Should be able to use the Path switch" {
|
|
|
|
|
{ Set-Location -Path / } | Should Not Throw
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
It "Should generate a pathinfo object when using the Passthru switch" {
|
|
|
|
|
$(Set-Location / -PassThru).GetType().Name | Should Be PathInfo
|
|
|
|
|
}
|
|
|
|
|
|
2015-10-23 12:07:49 -07:00
|
|
|
Set-Location $startDirectory
|
2015-10-23 10:01:44 -07:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|