Make minor fixes in Compiler to properly handle void type expression#5764
Make minor fixes in Compiler to properly handle void type expression#5764daxian-dbw merged 2 commits intoPowerShell:masterfrom
Conversation
|
|
||
| It "@([void](New-Item)) should create file" { | ||
| try { | ||
| $testFile = "$TestDrive\test.txt" |
There was a problem hiding this comment.
I'd like to see more reliable tests - could we use the file name based on guid or do $testFile | Should Not Exist?
There was a problem hiding this comment.
Isn't the contract with Pester to create a new directory for every It block? Assuming that's the case, reliability shouldn't be a concern.
There was a problem hiding this comment.
When I see tons of files and directories in my temp folder I always wonder this though a debugger and Ctrl-C are the simplest ways to create trash. :-)
From docs:
- TestDrive is a PowerShell PSDrive for file activity limited to the scope of a single Describe or Context block.
Also sometimes we have bugs with not closed and blocked files.
lzybkr
left a comment
There was a problem hiding this comment.
You might consider testing the cast to [void] when it's not the first element, or all elements.
You might also consider testing a non-void method invocation cast to void as well as a void returning method invocation.
|
@daxian-dbw Is the PR ready to merge or you will continue? |
|
@iSazonov Sorry for the late response. I will address Jason's and your comments. |
|
LGTM. |
PR Summary
Make some minor fixes in Compiler to properly handle
voidtype expressions.Before Fix
After Fix
PR Checklist
Note: Please mark anything not applicable to this PR
NA.[feature]if the change is significant or affectes feature testsWIP:to the beginning of the title and remove the prefix when the PR is ready.