Editing for OSX passing symbolic links

This commit is contained in:
Alex Jordan 2016-07-11 20:56:34 -07:00
parent e8386bd4b9
commit 4a4df0f080

View file

@ -36,7 +36,7 @@ Describe "New-Item" {
It "Should create a file without error" { It "Should create a file without error" {
New-Item -Name $testfile -Path $tmpDirectory -ItemType file New-Item -Name $testfile -Path $tmpDirectory -ItemType file
Test-Path $FullyQualifiedFile | Should Be $true Test-Path $FullyQualifiedFile | Should Be $true
$fileInfo = Get-ChildItem $FullyQualifiedFile $fileInfo = Get-ChildItem $FullyQualifiedFile
$fileInfo.Target | Should Be $null $fileInfo.Target | Should Be $null
@ -105,14 +105,15 @@ Describe "New-Item" {
} }
It "Should create a symbolic link of a file without error" { It "Should create a symbolic link of a file without error" {
New-Item -Name $testfile -Path $tmpDirectory -ItemType file New-Item -Name $testfile -Path $tmpDirectory -ItemType file
Test-Path $FullyQualifiedFile | Should Be $true Test-Path $FullyQualifiedFile | Should Be $true
New-Item -ItemType SymbolicLink -Target $FullyQualifiedFile -Name $testlink -Path $tmpDirectory New-Item -ItemType SymbolicLink -Target $FullyQualifiedFile -Name $testlink -Path $tmpDirectory
Test-Path $FullyQualifiedLink | Should Be $true Test-Path $FullyQualifiedLink | Should Be $true
$target = $FullyQualifiedFile
$fileInfo = Get-ChildItem $FullyQualifiedLink $fileInfo = Get-ChildItem $FullyQualifiedLink
$fileInfo.Target | Should Be $FullyQualifiedFile $fileInfo.Target | Should Be $target
$fileInfo.LinkType | Should Be "SymbolicLink" $fileInfo.LinkType | Should Be "SymbolicLink"
} }
@ -128,18 +129,18 @@ Describe "New-Item" {
} }
It "Should create a symbolic link from directory without error" { It "Should create a symbolic link from directory without error" {
New-Item -Name $testFolder -Path $tmpDirectory -ItemType directory New-Item -Name $testFolder -Path $tmpDirectory -ItemType directory
Test-Path $FullyQualifiedFolder | Should Be $true Test-Path $FullyQualifiedFolder | Should Be $true
New-Item -ItemType SymbolicLink -Target $FullyQualifiedFolder -Name $testlink -Path $tmpDirectory New-Item -ItemType SymbolicLink -Target $FullyQualifiedFolder -Name $testlink -Path $tmpDirectory
Test-Path $FullyQualifiedLink | Should Be $true Test-Path $FullyQualifiedLink | Should Be $true
$fileInfo = Get-ChildItem $FullyQualifiedLink $fileInfo = Get-ChildItem $FullyQualifiedLink
$fileInfo.Target | Should Be $FullyQualifiedFolder $fileInfo.Target | Should Be $FullyQualifiedFolder
$fileInfo.LinkType | Should Be "SymbolicLink" $fileInfo.LinkType | Should Be "SymbolicLink"
# Remove the link explicitly to avoid broken symlink issue # Remove the link explicitly to avoid broken symlink issue
Remove-Item $FullyQualifiedLink -Force Remove-Item $FullyQualifiedLink -Force
} }
It "Should create a hard link of a file without error" { It "Should create a hard link of a file without error" {
@ -154,6 +155,4 @@ Describe "New-Item" {
$fileInfo.LinkType | Should Be "HardLink" $fileInfo.LinkType | Should Be "HardLink"
} }
} }