From e6980894f72212b379ca52690a152066de1a05d1 Mon Sep 17 00:00:00 2001 From: George Fleming Date: Mon, 28 Mar 2016 14:35:34 -0700 Subject: [PATCH] Modify tests to display link type and link target --- test/powershell/New-Item.Tests.ps1 | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/powershell/New-Item.Tests.ps1 b/test/powershell/New-Item.Tests.ps1 index 5a873316e..f581f9be8 100644 --- a/test/powershell/New-Item.Tests.ps1 +++ b/test/powershell/New-Item.Tests.ps1 @@ -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" }