Skip to content

Commit ca97afd

Browse files
committed
added test, fixed an error in sign and package script
1 parent 8e9c587 commit ca97afd

File tree

2 files changed

+52
-2
lines changed

2 files changed

+52
-2
lines changed

.azdevops/SignAndPackageModule.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ $BuildOutputDir = Join-Path $root "\src\bin\Release"
1212
$ManifestPath = "${BuildOutputDir}\${Name}.psd1"
1313
$ManifestData = Import-PowerShellDataFile -Path $ManifestPath
1414
$Version = $ManifestData.ModuleVersion
15-
$Prerelease = $ManifestPath.PrivateData.PSData.Prerelease
15+
#$Prerelease = $ManifestPath.PrivateData.PSData.Prerelease
1616

1717
# this takes the files for the module and publishes them to a created, local repository
1818
# so the nupkg can be used to publish to the PSGallery
@@ -32,7 +32,7 @@ function Export-Module
3232
Publish-Module -Path $packageRoot -Repository $repoName
3333
Unregister-PSRepository -Name $repoName
3434
Get-ChildItem -Recurse -Name $packageRoot | Write-Verbose
35-
$nupkgName = "{0}.{1}-{2}.nupkg" -f ${Name},${Version},${Prerelease}
35+
$nupkgName = "{0}.{1}-preview2.nupkg" -f ${Name},${Version}
3636

3737

3838
$nupkgPath = Join-Path $packageRoot $nupkgName

Tests/Compress-Archive.Tests.ps1

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -785,4 +785,54 @@ BeforeDiscovery {
785785
$archiveInUseStream.Dispose()
786786
}
787787
}
788+
789+
Context "Long path tests" {
790+
BeforeAll {
791+
if ($IsWindows) {
792+
$maxPathLength = 260
793+
}
794+
if ($IsLinux) {
795+
$maxPathLength = 255
796+
}
797+
if ($IsMacOS) {
798+
$maxPathLength = 1024
799+
}
800+
801+
function Get-MaxLengthPath {
802+
param (
803+
[string] $character
804+
)
805+
806+
$path = "${TestDrive}/"
807+
while ($path.Length -le $maxPathLength + 2) {
808+
$path += $character
809+
}
810+
return $path
811+
}
812+
813+
New-Item -Path "TestDrive:/file.txt" -ItemType File
814+
"Hello, World!" | Out-File -FilePath "TestDrive:/file.txt"
815+
}
816+
817+
818+
It "Throws an error when -Path is too long" {
819+
820+
}
821+
822+
It "Throws an error when -LiteralPath is too long" {
823+
824+
}
825+
826+
It "Throws an error when -DestinationPath is too long" {
827+
$path = "TestDrive:/file.txt"
828+
# This will generate a path like TestDrive:/aaaaaa...aaaaaa
829+
$destinationPath = Get-MaxLengthPath -character a
830+
Write-Warning $destinationPath.Length
831+
try {
832+
Compress-Archive -Path $path -DestinationPath $destinationPath
833+
} catch {
834+
throw "${$_.Exception}"
835+
}
836+
}
837+
}
788838
}

0 commit comments

Comments
 (0)