Skip to content

Fixing a mocking parameter bug#187

Merged
dlwyatt merged 1 commit intopester:Betafrom
dlwyatt:MockFix
Aug 13, 2014
Merged

Fixing a mocking parameter bug#187
dlwyatt merged 1 commit intopester:Betafrom
dlwyatt:MockFix

Conversation

@dlwyatt
Copy link
Copy Markdown
Member

@dlwyatt dlwyatt commented Aug 13, 2014

@Jaykul pointed out a problem where the $args variable in a mock's stub function can resolve to the value of $args in a parent scope; the automatic version of $args only exists for functions without the CmdletBinding attribute. (Mocks of cmdlets and advanced functions can demonstrate the bug, if a variable named $args is defined in a parent scope of the call to the mocked command.)

The prototype function used to generate these stubs now looks specifically for a variable named args in the local scope, not allowing it to fetch the parent scope's values.

@Jaykul pointed out a problem where the $args variable in a mock's stub function can resolve to the value of $args in a parent scope; the automatic version of $args only exists for non-advanced functions.

The prototype function used to generate these stubs now looks specifically for a variable named args in the local scope, not allowing it to fetch the parent scope's values.
dlwyatt added a commit that referenced this pull request Aug 13, 2014
Fixing a mocking parameter bug
@dlwyatt dlwyatt merged commit 91fb2d1 into pester:Beta Aug 13, 2014
@dlwyatt dlwyatt deleted the MockFix branch August 13, 2014 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant