Merge pull request #749 from PowerShell/morelinks

New Linux GetTarget and GetLinkType for symbolic and hard links

Also fixes GetChildItem for symbolic links
This commit is contained in:
Andy Schwartzmeyer 2016-03-29 11:15:47 -07:00
commit 85b00bfaf3
3 changed files with 18 additions and 2 deletions

@ -1 +1 @@
Subproject commit 86801f0457df8bd582cd861d656cb47313c65824
Subproject commit 454524cf7294021584a3005f2f3243c80b670a89

@ -1 +1 @@
Subproject commit 569bde91d43a30435a60a33343196217547d81a5
Subproject commit 40fc8ff46b3f21ded304524b6734ab0fd63359ee

View file

@ -37,6 +37,10 @@ Describe "New-Item" {
New-Item -Name $testfile -Path $tmpDirectory -ItemType file
Test-Path $FullyQualifiedFile | Should Be $true
$fileInfo = Get-ChildItem $FullyQualifiedFile
$fileInfo.Target | Should Be $null
$fileInfo.LinkType | Should Be $null
}
It "Should create a folder without an error" {
@ -106,6 +110,10 @@ Describe "New-Item" {
New-Item -ItemType SymbolicLink -Target $FullyQualifiedFile -Name $testlink -Path $tmpDirectory
Test-Path $FullyQualifiedLink | Should Be $true
$fileInfo = Get-ChildItem $FullyQualifiedLink
$fileInfo.Target | Should Be $FullyQualifiedFile
$fileInfo.LinkType | Should Be "SymbolicLink"
}
It "Should create a symbolic link from directory without error" -Skip:$IsWindows {
@ -115,6 +123,10 @@ Describe "New-Item" {
New-Item -ItemType SymbolicLink -Target $FullyQualifiedFolder -Name $testlink -Path $tmpDirectory
Test-Path $FullyQualifiedLink | Should Be $true
$fileInfo = Get-ChildItem $FullyQualifiedLink
$fileInfo.Target | Should Be $FullyQualifiedFolder
$fileInfo.LinkType | Should Be "SymbolicLink"
# Remove the link explicitly to avoid broken symlink issue
Remove-Item $FullyQualifiedLink -Force
}
@ -125,6 +137,10 @@ Describe "New-Item" {
New-Item -ItemType HardLink -Target $FullyQualifiedFile -Name $testlink -Path $tmpDirectory
Test-Path $FullyQualifiedLink | Should Be $true
$fileInfo = Get-ChildItem $FullyQualifiedLink
$fileInfo.Target | Should Be $null
$fileInfo.LinkType | Should Be "HardLink"
}