-
Notifications
You must be signed in to change notification settings - Fork 403
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #628 from dfinke/RelativePath
Added resolve-path and tests. #627; Commented out write-warning
- Loading branch information
Showing
3 changed files
with
80 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
Describe "Test reading relative paths" { | ||
BeforeAll { | ||
$script:xlfileName = "TestR.xlsx" | ||
@{data = 1 } | Export-Excel "$pwd\TestR.xlsx" | ||
} | ||
|
||
AfterAll { | ||
Remove-Item "$pwd\$($script:xlfileName)" | ||
} | ||
|
||
It "Should read local file" { | ||
$actual = Import-Excel -Path ".\$($script:xlfileName)" | ||
$actual | Should Not Be $null | ||
$actual.Count | Should Be 1 | ||
} | ||
|
||
It "Should read with pwd" { | ||
$actual = Import-Excel -Path "$pwd\$($script:xlfileName)" | ||
$actual | Should Not Be $null | ||
} | ||
|
||
It "Should read with just a file name and resolve to cwd" { | ||
$actual = Import-Excel -Path "$($script:xlfileName)" | ||
$actual | Should Not Be $null | ||
} | ||
|
||
It "Should fail for not found" { | ||
{ Import-Excel -Path "ExcelFileDoesNotExist.xlsx" } | Should Throw "'ExcelFileDoesNotExist.xlsx' file not found" | ||
} | ||
|
||
It "Should fail for xls extension" { | ||
{ Import-Excel -Path "ExcelFileDoesNotExist.xls" } | Should Throw "Import-Excel does not support reading this extension type .xls" | ||
} | ||
|
||
It "Should fail for xlsxs extension" { | ||
{ Import-Excel -Path "ExcelFileDoesNotExist.xlsxs" } | Should Throw "Import-Excel does not support reading this extension type .xlsxs" | ||
} | ||
} |
Binary file not shown.