GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Added tests for hashtabletoPSCustomObjectConversion, OutErrorVairable… by bingbing8 · Pull Request #2160 · PowerShell/PowerShell

Conversation

@bingbing8

@bingbing8 Yanbing (bingbing8) commented Sep 1, 2016

Copy link
Copy Markdown
Contributor

Added tests for hashtabletoPSCustomObjectConversion, OutErrorVairable. Please review.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bingbing8
Added tests for hashtabletoPSCustomObjectConversion, OutErrorVairable…
96ff914
… tests.
@msftclas

Microsoft Contribution License Agreements (msftclas) commented Sep 1, 2016

Copy link
Copy Markdown

Hi Yanbing (@bingbing8), I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!


It looks like you're a Microsoft contributor (Yanbing Wang). If you're full-time, we DON'T require a Contribution License Agreement. If you are a vendor, please DO sign the electronic Contribution License Agreement. It will take 2 minutes and there's no faxing! https://cla.microsoft.com.

TTYL, MSBOT;

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@msftclas Microsoft Contribution License Agreements (msftclas) added the cla-not-required label Sep 1, 2016
@bingbing8
Update the title of hashtable to PSCustomObject conversion.
31f22c6
@TravisEz13 Travis Plunk (TravisEz13) added the Review - Needed label Sep 2, 2016
@vors sergei (vors) closed this Sep 2, 2016
@vors sergei (vors) reopened this Sep 2, 2016
@msftclas

Microsoft Contribution License Agreements (msftclas) commented Sep 2, 2016

Copy link
Copy Markdown

Hi Yanbing (@bingbing8), I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!


It looks like you're a Microsoft contributor (Yanbing Wang). If you're full-time, we DON'T require a Contribution License Agreement. If you are a vendor, please DO sign the electronic Contribution License Agreement. It will take 2 minutes and there's no faxing! https://cla.microsoft.com.

TTYL, MSBOT;

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@msftclas Microsoft Contribution License Agreements (msftclas) added the cla-not-required label Sep 2, 2016
@JamesWTruher

James Truher (JamesWTruher) commented Sep 2, 2016 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

��D�e�s�c�r�i�b�e� �"�T�e�s�t�s� �f�o�r� �h�a�s�h�t�a�b�l�e� �t�o� �P�S�C�u�s�t�o�m�O�b�j�e�c�t� �c�o�n�v�e�r�s�i�o�n�"� �-�T�a�g�s� �"�C�I�"� �{�

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)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@JamesWTruher

James Truher (JamesWTruher) commented Sep 2, 2016

Copy link
Copy Markdown
Collaborator

� � � � � � � � �I�t� �'�$�a� �t�y�p�e�'� �{� �$�a� �-�i�s� �[�S�y�s�t�e�m�.�M�a�n�a�g�e�m�e�n�t�.�A�u�t�o�m�a�t�i�o�n�.�P�S�O�b�j�e�c�t�]� �|� �S�h�o�u�l�d� �B�e� �$�t�r�u�e� �}� � � � � � � � �

this can be

it '$a type' { $a | should BeOfType "System.Management.automation.psobject" }

Refers to: test/powershell/Language/Scripting/HashtableToPSCustomObjectConversion.Tests.ps1:15 in 31f22c6. [](commit_id = 31f22c6, deletion_comment = False)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@JamesWTruher

James Truher (JamesWTruher) commented Sep 2, 2016

Copy link
Copy Markdown
Collaborator

�

I don't think we really need a new type here - wouldn't this be ok?

describe "good description here" {
    it "good test name here" {
        try {
            new-object System.Management.Automation.MetadataException -property @{ Source = "foobar"; aa = 1 }
            throw "OK"
        }
        catch {
            $_.Exception | Should BeOfType "InvalidOperationException"
            $_.Exception.Message | Should Match "aa"
            $_.FullyQualifiedErrorId | should be "InvalidOperationException,Microsoft.PowerShell.Commands.NewObjectCommand"
        }
    }
}

Refers to: test/powershell/Language/Scripting/HashtableToPSCustomObjectConversion.Tests.ps1:66 in 31f22c6. [](commit_id = 31f22c6, deletion_comment = False)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

JamesWTruher
JamesWTruher reviewed Sep 2, 2016
View reviewed changes
Comment thread test/powershell/Language/Scripting/OutErrorVariable.Tests.ps1 Outdated
}

Context 'Updating OutVariable Case 1: pipe string' {

@JamesWTruher James Truher (JamesWTruher) Sep 2, 2016

Copy link
Copy Markdown
Collaborator

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
    }

}

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@bingbing8 Yanbing (bingbing8) Sep 3, 2016

Copy link
Copy Markdown
Contributor Author

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: 77278055 [](ancestors = 77278055)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@daxian-dbw Dongbo Wang (daxian-dbw) added Review - Waiting on Author and removed Review - Needed labels Sep 2, 2016
@TravisEz13 Travis Plunk (TravisEz13) added Review - Needed and removed Review - Waiting on Author labels Sep 2, 2016
@bingbing8

Yanbing (bingbing8) commented Sep 2, 2016

Copy link
Copy Markdown
Contributor Author

��D�e�s�c�r�i�b�e� �"�T�e�s�t�s� �f�o�r� �h�a�s�h�t�a�b�l�e� �t�o� �P�S�C�u�s�t�o�m�O�b�j�e�c�t� �c�o�n�v�e�r�s�i�o�n�"� �-�T�a�g�s� �"�C�I�"� �{�

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)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bingbing8

Yanbing (bingbing8) commented Sep 2, 2016

Copy link
Copy Markdown
Contributor Author

� � � � � � � � �I�t� �'�$�a� �t�y�p�e�'� �{� �$�a� �-�i�s� �[�S�y�s�t�e�m�.�M�a�n�a�g�e�m�e�n�t�.�A�u�t�o�m�a�t�i�o�n�.�P�S�O�b�j�e�c�t�]� �|� �S�h�o�u�l�d� �B�e� �$�t�r�u�e� �}� � � � � � � � �

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)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bingbing8

Yanbing (bingbing8) commented Sep 2, 2016

Copy link
Copy Markdown
Contributor Author

�

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)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Yanbing (bingbing8) added 9 commits September 2, 2016 18:43
@bingbing8
Update based on PR feedback
40ad73b
@bingbing8
updated more cases using testcase
0d8f3f9
@bingbing8
update the format of the array
17a518b
@bingbing8
Update to investigate an failure only happy in CI system
58486a7
@bingbing8
update one test in OutErrorVariable
daf1bf7
@bingbing8
update a test title
3895779
@bingbing8
Fixed tests which has impact on other tests
71feca8
@bingbing8
remove line to clean up the global variable since it has been changed…
ea5cb25
… o scipt scope.
@bingbing8
Removed two lines for debugging purpuse
650c73a
@bingbing8

Yanbing (bingbing8) commented Sep 7, 2016

Copy link
Copy Markdown
Contributor Author

James Truher (@JamesWTruher) I updated the tests based on your feedback. some of the replies don't show in browser. please check out. Thanks!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vors sergei (vors) assigned James Truher (JamesWTruher) Sep 8, 2016
@vors

sergei (vors) commented Sep 8, 2016

Copy link
Copy Markdown
Collaborator

Assigning the PR to James Truher (@JamesWTruher)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

JamesWTruher
JamesWTruher reviewed Sep 9, 2016
View reviewed changes
Comment thread test/powershell/Language/Scripting/HashtableToPSCustomObjectConversion.Tests.ps1

It '$a should not be $null' { $script:a | Should Not Be $null }
It '$a type' { $script:a | should BeOfType "System.Management.automation.psobject" }
}

@JamesWTruher James Truher (JamesWTruher) Sep 9, 2016

Copy link
Copy Markdown
Collaborator

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@bingbing8 Yanbing (bingbing8) Sep 11, 2016

Copy link
Copy Markdown
Contributor Author

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: 78253881 [](ancestors = 78253881)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@JamesWTruher

James Truher (JamesWTruher) commented Sep 9, 2016 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

:shipit:

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bingbing8

Yanbing (bingbing8) commented Sep 12, 2016

Copy link
Copy Markdown
Contributor Author

James Truher (@JamesWTruher) Thanks for your feedback. I addressed all of them. Please check.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bingbing8
Updated based on Jim's feedback.
ae43dae
@JamesWTruher

James Truher (JamesWTruher) commented Sep 12, 2016

Copy link
Copy Markdown
Collaborator

:shipit:

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

vors
vors reviewed Sep 12, 2016
View reviewed changes
Comment thread test/csharp/csharp.nuget.props Outdated
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>

@vors sergei (vors) Sep 12, 2016

Copy link
Copy Markdown
Collaborator

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 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.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@bingbing8 Yanbing (bingbing8) Sep 12, 2016

Copy link
Copy Markdown
Contributor Author

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.

Sergei (@sergei) Vorobev good catch. I removed the file. Thanks!


In reply to: 78430315 [](ancestors = 78430315)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@vors sergei (vors) assigned sergei (vors) and unassigned James Truher (JamesWTruher) Sep 12, 2016
@vors

sergei (vors) commented Sep 12, 2016

Copy link
Copy Markdown
Collaborator

🕐

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vors sergei (vors) added Review - Waiting on Author and removed Review - Needed labels Sep 12, 2016
Yanbing (bingbing8) added 2 commits September 12, 2016 13:40
@bingbing8
remove file csharp.nuget.props from the PR. It was added by mistake.
4e54e84
@bingbing8
added new lines at the end of the files.
08758ca
@TravisEz13 Travis Plunk (TravisEz13) added Review - Needed and removed Review - Waiting on Author labels Sep 12, 2016
@vors
sergei (vors) merged commit fd4552b into PowerShell:master Sep 13, 2016
Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj-contribs/PowerShell that referenced this pull request Aug 6, 2026
@bingbing8 @vors
Added tests for hashtabletoPSCustomObjectConversion, OutErrorVairable…
294ecbb
… tests (PowerShell#2160)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@vors sergei (vors)

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

6 participants

@bingbing8 @msftclas @JamesWTruher @vors @daxian-dbw @TravisEz13
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.