Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -570,11 +570,26 @@ Describe "Hard link and symbolic link tests" -Tags "CI", "RequireAdminOnWindows"
$ci[1].Name | Should -MatchExactly $filenamePattern
$ci[2].Name | Should -MatchExactly $filenamePattern
}
It "Get-ChildItem -Name gets content of linked-to directory" {
# The test depends on the files created in previous test:
#$filenamePattern = "AlphaFile[12]\.txt"
#New-Item -ItemType SymbolicLink -Path $alphaLink -Value $alphaDir
$ci = Get-ChildItem $alphaLink -Name
$ci.Count | Should -Be 3
$ci[1] | Should -MatchExactly $filenamePattern
$ci[2] | Should -MatchExactly $filenamePattern
}
It "Get-ChildItem does not recurse into symbolic links not explicitly given on the command line" {
New-Item -ItemType SymbolicLink -Path $betaLink -Value $betaDir
$ci = Get-ChildItem $alphaLink -Recurse
$ci.Count | Should -BeExactly 7
}
It "Get-ChildItem -Name does not recurse into symbolic links not explicitly given on the command line" -Pending {
# The test depends on the files created in previous test:
#New-Item -ItemType SymbolicLink -Path $betaLink -Value $betaDir
$ci = Get-ChildItem $alphaLink -Recurse -Name
$ci.Count | Should -BeExactly 7 # returns 10 - unexpectly recurce in link-alpha\link-Beta. See https://github.com/PowerShell/PowerShell/issues/11614
}
It "Get-ChildItem will recurse into symlinks given -FollowSymlink, avoiding link loops" {
New-Item -ItemType Directory -Path $gammaDir
New-Item -ItemType SymbolicLink -Path $uponeLink -Value $betaDir
Expand All @@ -584,6 +599,16 @@ Describe "Hard link and symbolic link tests" -Tags "CI", "RequireAdminOnWindows"
$ci.Count | Should -BeExactly 13
$w.Count | Should -BeExactly 3
}
It "Get-ChildItem -Name will recurse into symlinks given -FollowSymlink, avoiding link loops" -Pending {
# The test depends on the files created in previous test:
# New-Item -ItemType Directory -Path $gammaDir
# New-Item -ItemType SymbolicLink -Path $uponeLink -Value $betaDir
# New-Item -ItemType SymbolicLink -Path $uptwoLink -Value $alphaDir
# New-Item -ItemType SymbolicLink -Path $omegaLink -Value $omegaDir
$ci = Get-ChildItem -Path $alphaDir -FollowSymlink -Recurse -WarningVariable w -WarningAction SilentlyContinue -Name # unexpectly dead cycle. See https://github.com/PowerShell/PowerShell/issues/11614
$ci.Count | Should -BeExactly 13
$w.Count | Should -BeExactly 3
}
}

Context "Remove-Item and hard/symbolic links" {
Expand Down
Loading