From d8a437a4e71d84f36ed7aabdd356e37a28d5ea34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20K=C5=82ys?= Date: Sun, 10 Aug 2025 11:01:23 +0200 Subject: [PATCH] Fix invalid path test for cross-platform --- Tests/ExcelWorkbook.Tests.ps1 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Tests/ExcelWorkbook.Tests.ps1 b/Tests/ExcelWorkbook.Tests.ps1 index 266bdb4..7cdef01 100644 --- a/Tests/ExcelWorkbook.Tests.ps1 +++ b/Tests/ExcelWorkbook.Tests.ps1 @@ -12,7 +12,9 @@ Describe 'Excel workbook cmdlets' { It 'throws when saving to invalid path' { $workbook = New-OfficeExcel New-OfficeExcelWorkSheet -Workbook $workbook -WorksheetName 'Sheet1' | Out-Null - { Save-OfficeExcel -Workbook $workbook -FilePath 'C:\InvalidPath<>*|?"\missing.xlsx' -ErrorAction Stop } | Should -Throw + $invalidChar = [System.IO.Path]::GetInvalidFileNameChars() | Select-Object -First 1 + $invalidPath = Join-Path $TestDrive "invalid$invalidChar.xlsx" + { Save-OfficeExcel -Workbook $workbook -FilePath $invalidPath -ErrorAction Stop } | Should -Throw } It 'throws when loading from invalid path' {