Rework passing array literal to native commands#5301
Merged
daxian-dbw merged 2 commits intoPowerShell:masterfrom Nov 7, 2017
Merged
Rework passing array literal to native commands#5301daxian-dbw merged 2 commits intoPowerShell:masterfrom
daxian-dbw merged 2 commits intoPowerShell:masterfrom
Conversation
vors
reviewed
Nov 2, 2017
| } | ||
|
|
||
| It "Should handle PowerShell arrays with or without spaces correctly: <arguments>" -TestCases @( | ||
| @{arguments = "a 1,2"; expected = "a", "1,2"} |
Collaborator
There was a problem hiding this comment.
let's add something boring, like a,1,2 here as well
Contributor
Author
There was a problem hiding this comment.
There is no difference between 2 and 3 elements - it's just spaces around the argument(s) that matter.
Contributor
Author
There was a problem hiding this comment.
I really didn't need a 1,2, 1,2 would have been sufficient, but I had a bug in the test with array vs. scalar and the first thought I had was to add a to force array. I'm fixing by using @() instead to force array.
iSazonov
reviewed
Nov 2, 2017
| "array argument and ArrayLiteralAst differ in number of elements"); | ||
|
|
||
| int currentElement = -1; | ||
| string separator = ""; |
Collaborator
There was a problem hiding this comment.
Should we use String.Empty?
| var beforeNext = next.Extent.StartOffset - 1; | ||
|
|
||
| if (afterPrev == beforeNext) | ||
| return ","; |
Collaborator
There was a problem hiding this comment.
Could you please use one line formatting as above in line 357?
Below too in 376 and 379.
| } | ||
|
|
||
| It "Should handle PowerShell arrays with or without spaces correctly: <arguments>" -TestCases @( | ||
| @{arguments = "a 1,2"; expected = "a", "1,2"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Now that the Ast is passed through to the NativeCommandParameterBinder, there is a cleaner fix to ensuring we pass the correct text to a command that uses PowerShell array syntax.