-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Added tests for hashtabletoPSCustomObjectConversion, OutErrorVairable… #2160
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
Added tests for hashtabletoPSCustomObjectConversion, OutErrorVairable… #2160
Conversation
|
Hi @bingbing8, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!
TTYL, MSBOT; |
|
Hi @bingbing8, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!
TTYL, MSBOT; |
this file looks to be the wrong encoding - can you be sure that the BOM is not present and that the file is UTF8 (or ascii) - it's really hard to read Refers to: test/powershell/Language/Scripting/HashtableToPSCustomObjectConversion.Tests.ps1:1 in 31f22c6. [](commit_id = 31f22c6, deletion_comment = False) |
this can be Refers to: test/powershell/Language/Scripting/HashtableToPSCustomObjectConversion.Tests.ps1:15 in 31f22c6. [](commit_id = 31f22c6, deletion_comment = False) |
I don't think we really need a new type here - wouldn't this be ok? Refers to: test/powershell/Language/Scripting/HashtableToPSCustomObjectConversion.Tests.ps1:66 in 31f22c6. [](commit_id = 31f22c6, deletion_comment = False) |
| } | ||
|
|
||
| Context 'Updating OutVariable Case 1: pipe string' { | ||
|
|
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.
These aren't going to do anything because they're not in it blocks, also these really look like they could all be done via test cases
$testcases = @{ Title = "Updating OutVariable Case 1: pipe string"; command = "get-foo1"; OutVariable = "a"; Expected = "foo" },
@{ Title = 'Updating OutVariable Case 2: $pscmdlet.writeobject'; command = "get-foo1"; OutVariable = "a"; Expected = "foo" }
Describe Tests {
BeforeAll {
function get-foo1
{
[CmdletBinding()]
param()
"foo"
}
function get-foo2
{
[CmdletBinding()]
param()
$pscmdlet.writeobject("foo")
}
function get-bar
{
[CmdletBinding()]
param()
"bar"
get-foo1 -outVariable global:a
}
}
It "<Title>" -TestCases $testcases {
param ( $command, $arguments, $Expected, $OutVariable )
& $command -OutVariable $OutVariable > $null
Get-Variable -ValueOnly $outVariable | should be $Expected
}
}
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.
fixed In reply to: 244248919 [](ancestors = 244248919) Refers to: test/powershell/Language/Scripting/HashtableToPSCustomObjectConversion.Tests.ps1:1 in 31f22c6. [](commit_id = 31f22c6, deletion_comment = False) |
fixed In reply to: 244249354 [](ancestors = 244249354) Refers to: test/powershell/Language/Scripting/HashtableToPSCustomObjectConversion.Tests.ps1:15 in 31f22c6. [](commit_id = 31f22c6, deletion_comment = False) |
|
@JamesWTruher I updated the tests based on your feedback. some of the replies don't show in browser. please check out. Thanks! |
|
Assigning the PR to @JamesWTruher |
|
|
||
| It '$a should not be $null' { $script:a | Should Not Be $null } | ||
| It '$a type' { $script:a | should BeOfType "System.Management.automation.psobject" } | ||
| } |
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.
it seems that this is much too complicated, can't it just be:
It 'New-Object cmdlet should accept empty hashtable or $null as Property argument' {
$a = new-object psobject -property
$a | should not BeNullOrEmpty
$a | should BeOfType "System.Management.Automation.PSObject"
}
I don't see the point of the extra it statements, if the first line throws the test will fail
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.
|
|
|
@JamesWTruher Thanks for your feedback. I addressed all of them. Please check. |
|
|
test/csharp/csharp.nuget.props
Outdated
| @@ -0,0 +1,10 @@ | |||
| <?xml version="1.0" encoding="utf-8" standalone="no"?> | |||
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.
please, remove this file from the PR.
In #2182 @douglaswth added it to ,gitignore.
Particularly because this file contains env-specific line
<NuGetPackageRoot>C:\git\part4\Packages</NuGetPackageRoot>
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.
|
🕐 |
Added tests for hashtabletoPSCustomObjectConversion, OutErrorVairable. Please review.