| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
There was a problem hiding this comment.
Is there a more specific check that it failed because of reserved name vs something else?
Sorry, something went wrong.
There was a problem hiding this comment.
The current code throws an IOException with a localized string as its message, and uses "CopyError" ("MoveError"/"RenameError") in the error record.
We could modify the error ID in the error record to say something like "CopyToReservedNameError", with "MoveTo" and "RenameTo" versions, if that wouldn't badly impact existing user code.
Sorry, something went wrong.
There was a problem hiding this comment.
It is in common function PathIsReservedDeviceName
We could make new specific IOException but is it worth?
Sorry, something went wrong.
There was a problem hiding this comment.
Probably not worth it then.
Sorry, something went wrong.
There was a problem hiding this comment.
$tempFile seems not necessary in these tests. $testFile is created in BeforeEach and removed in AfterEach, so you can use testFile directly here.
Sorry, something went wrong.
There was a problem hiding this comment.
For Move-Item and Rename-Item the $tempFile was to be able to restore $testFile each time through the foreach across device names. I can certainly use New-Item to create a new $testFile each iteration if you prefer.
Sorry, something went wrong.
There was a problem hiding this comment.
Ah, right. It's in a loop. Ignore my comment. #Closed
Sorry, something went wrong.
There was a problem hiding this comment.
How about just Test-Path $deviceName | Should Be $true?
Sorry, something went wrong.
There was a problem hiding this comment.
I was just keeping consistency with existing tests. I'm happy to make this change. Should I do so for the pre-existing tests as well?
Sorry, something went wrong.
There was a problem hiding this comment.
I see. You can submit a new PR later to address that particular issue. #Closed
Sorry, something went wrong.
There was a problem hiding this comment.
Ditto here. #Closed
Sorry, something went wrong.
There was a problem hiding this comment.
I suppose that's enough:
Copy-Item -Path $testFile -Destination $deviceName -Force -ErrorAction SilentlyContinue
Test-Path $deviceName | Should Be $trueThe same for tests below.
Sorry, something went wrong.
There was a problem hiding this comment.
jeffbi It would be great if you can address this comment, but it doesn't block merging this PR in case you want to address it later for all existing tests in this file. Please let me know.
Sorry, something went wrong.
There was a problem hiding this comment.
I've addressed Ilya (@iSazonov)'s comments here. I'll put off changing the previously existing tests.
Sorry, something went wrong.
There was a problem hiding this comment.
Maybe more specifically:
"Copy-Item succeeds on Unix with Windows reserved device names"
Sorry, something went wrong.
There was a problem hiding this comment.
Yeah, I agree. I'll change that.
Sorry, something went wrong.
| It "Move-Item on Unix succeeds with Windows reserved device names" -Skip:($IsWindows) { | ||
| foreach ($deviceName in $reservedNames) | ||
| { | ||
| Copy-Item -Path $testFile -Destination $tempFile -Force |
There was a problem hiding this comment.
Maybe really use New-Item here? The code will be more clear.
Sorry, something went wrong.
There was a problem hiding this comment.
#Closed.
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Fixes #3221