GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Added tests for hashtabletoPSCustomObjectConversion, OutErrorVairable… by bingbing8 · Pull Request #2160 · PowerShell/PowerShell Conversation
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
| |||||||||||||||||||||||||||||||||||||||||||||
There was an error while loading. Please reload this page.
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) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
this can be Refers to: test/powershell/Language/Scripting/HashtableToPSCustomObjectConversion.Tests.ps1:15 in 31f22c6. [](commit_id = 31f22c6, deletion_comment = False) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
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) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| } | ||
|
|
||
| Context 'Updating OutVariable Case 1: pipe string' { | ||
|
|
There was a problem 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
}
}
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
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) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
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) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
fixed In reply to: 244251597 [](ancestors = 244251597) Refers to: test/powershell/Language/Scripting/HashtableToPSCustomObjectConversion.Tests.ps1:66 in 31f22c6. [](commit_id = 31f22c6, deletion_comment = False) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
James Truher (@JamesWTruher) I updated the tests based on your feedback. some of the replies don't show in browser. please check out. Thanks! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Assigning the PR to James Truher (@JamesWTruher) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
| 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.
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
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
James Truher (@JamesWTruher) Thanks for your feedback. I addressed all of them. Please check. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| @@ -0,0 +1,10 @@ | |||
| <?xml version="1.0" encoding="utf-8" standalone="no"?> | |||
There was a problem 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 Douglas Thrift (@douglaswth) added it to ,gitignore.
Particularly because this file contains env-specific line
<NuGetPackageRoot>C:\git\part4\Packages</NuGetPackageRoot>
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Sergei (@sergei) Vorobev good catch. I removed the file. Thanks!
In reply to: 78430315 [](ancestors = 78430315)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
🕐 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.