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
Enabling String and FileInfo Objects To Be Piped To Include Function #290
base: master
Are you sure you want to change the base?
Conversation
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
} | ||
|
||
Task Test { | ||
Assert ($(Test-Path "Function:\Test-Function1") -ne $null) "Test-Function1 is not accessible"; |
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.
Test-Path
will return $true/$false
so no need for the $null check.
If Test-Path
returns $false
, you're checking if that doesn't equal $null
, which it doesn't, so the assert passes when it shouldn't if the function doesn't actually exist.
You can test this by putting in a bogus function name like so:
Assert (Test-Path 'Function:\BogusFunction') 'BogusFunction is not accessible'
Assert ($(Test-Path 'Function:\BogusFunction') -ne $null) 'BogusFunction is not accessible'
Assert (Test-Path ...)
will be fine.
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.
Yeah... not sure what I was thinking when I wrote that. I'm guessing I intended to write "-ne $false". Should have tested my test.
Thanks; I'll get it corrected.
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.
Pushed the fix now :)
d81f0e7
to
c2a85bc
Compare
Description
You can now do this :
Related Issue
#289
Motivation and Context
Allows users to write slightly more concise code, rather than writing for loops.
How Has This Been Tested?
New Pester tests have been added to verify that it can accept pipeline input both in the form of strings and FileInfo objects.
I also manually tested that it was backwards compatible, and could still work with the fileNamePathToInclude parameter.
Screenshots (if appropriate):
Types of changes
Checklist: