You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Tests/Pester.Commands.Cmdlets.Archive.Tests.ps1
+54-18Lines changed: 54 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -256,15 +256,11 @@ Describe "Test suite for Microsoft.PowerShell.Archive module" -Tags "BVT" {
256
256
257
257
It "Validate errors from Compress-Archive when invalid path (non-existing path / non-filesystem path) is supplied for Path or LiteralPath parameters" {
# The tests below are no longer valid. You can have zip files with non-zip extensions. Different archive
269
265
# formats should be added in a separate pull request, with a parameter to identify the archive format, and
270
266
# default formats associated with specific extensions. Until then, as long as these cmdlets only support
@@ -336,7 +332,7 @@ Describe "Test suite for Microsoft.PowerShell.Archive module" -Tags "BVT" {
336
332
$destinationPath| Should Exist
337
333
}
338
334
# This test requires a fix in PS5 to support reading paths with square bracket
339
-
It "Validate that Compress-Archive cmdlet can accept LiteralPath parameter with Special Characters"-skip:($PSVersionTable.psversion-lt"5.0") {
335
+
It "Validate that Compress-Archive cmdlet can accept LiteralPath parameter with Special Characters"-skip:(($PSVersionTable.psversion.Major-lt5) -and ($PSVersionTable.psversion.Minor-lt0)) {
@@ -390,7 +386,7 @@ Describe "Test suite for Microsoft.PowerShell.Archive module" -Tags "BVT" {
390
386
}
391
387
}
392
388
# This test requires a fix in PS5 to support reading paths with square bracket
393
-
It "Validate that Compress-Archive cmdlet can accept LiteralPath parameter for a directory with Special Characters in the directory name"-skip:($PSVersionTable.psversion-lt"5.0") {
389
+
It "Validate that Compress-Archive cmdlet can accept LiteralPath parameter for a directory with Special Characters in the directory name"-skip:(($PSVersionTable.psversion.Major-lt5) -and ($PSVersionTable.psversion.Minor-lt0)) {
if (get-variable IsLinux -ErrorAction SilentlyContinue) { if ($IsLinux) {$expectedError="DriveNotFound,Microsoft.PowerShell.Commands.NewItemCommand"} }
722
727
try { Expand-Archive-Path $sourcePath-DestinationPath $destinationPath; throw"Expand-Archive did NOT throw expected error" }
723
-
catch { $_.FullyQualifiedErrorId| Should Be "InvalidDirectoryPath,Expand-Archive" }
728
+
catch { $_.FullyQualifiedErrorId| Should Be $expectedError }
724
729
}
725
730
726
731
It "Validate that you can compress an archive to a custom PSDrive using the Compress-Archive cmdlet" {
@@ -1063,7 +1068,8 @@ Describe "Test suite for Microsoft.PowerShell.Archive module" -Tags "BVT" {
1063
1068
Compare-Object-ReferenceObject $extractedList-DifferenceObject $sourceList-PassThru | Should Be $null
1064
1069
}
1065
1070
1066
-
It "Validate Expand-Archive works with zip files where the contents contain trailing whitespace" {
1071
+
# trailing spaces give this error on Linux: Exception calling "[System.IO.Compression.ZipFileExtensions]::ExtractToFile" with "3" argument(s): "Could not find a part of the path '/tmp/02132f1d-5b0c-4a99-b5bf-707cef7681a6/TrailingSpacer/Inner/TrailingSpace/test.txt'."
1072
+
It "Validate Expand-Archive works with zip files where the contents contain trailing whitespace"-skip:($IsLinux){
1067
1073
$archivePath="$TestDrive$($DS)TrailingSpacer.zip"
1068
1074
$destinationPath="$TestDrive$($DS)TrailingSpacer"
1069
1075
# we can't just compare the output and the results as you only get one DirectoryInfo for directories that only contain directories
@@ -1077,5 +1083,35 @@ Describe "Test suite for Microsoft.PowerShell.Archive module" -Tags "BVT" {
1077
1083
$contents[$i].FullName | Should Be $expectedPaths[$i]
1078
1084
}
1079
1085
}
1086
+
1087
+
It "Validate that Expand-Archive cmdlet works with backslashes in paths" {
0 commit comments