Increase code coverage of Get-ChildItem on file system.#4342
Increase code coverage of Get-ChildItem on file system.#4342adityapatwardhan merged 3 commits intoPowerShell:masterfrom jeffbi:tests-4148-gci
Conversation
|
|
||
| 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.
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.
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
-Nameparameter onGet-ChildItemexercises a part of the file system provider code not previously covered by tests.