-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Increase code coverage of Get-ChildItem on file system. #4342
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -84,6 +84,11 @@ Describe "Basic FileSystem Provider Tests" -Tags "CI" { | |||
$dirContents.Count | Should Be 2 | |||
} | |||
|
|||
It "Verity Get-ChildItem can get the name of a specified item." { | |||
$fileName = Get-ChildItem $testFile -Name | |||
$fileName | Should BeExactly $fileName |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This compares to itself.
I suggest calling Get-ChildItem twice, once with -Name to get the name string and once without to get the fileinfo. The test would look something like the following:
$filename | Should BeExactly $fileInfo.Name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yikes! Bad typo on my part. That should have been $filename | Should BeExactly $testFile
. Is making that change sufficient, or would you prefer the dual-call method?
You're better off comparing the returned value against the name property since, I believe, that's the intent. |
Well, the intent was to check that I got the item I asked for, which is why I was comparing against |
Sorry jeffbi; I should have been clearer. When I said the intent of -Name, I mean the intent is to return the Name property of the FileInfo object. |
Addresses part of #4148.
Using the
-Name
parameter onGet-ChildItem
exercises a part of the file system provider code not previously covered by tests.