Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Convert ShouldBeErrorId to Should -Throw -ErrorId in PowerShell tests#6682

Merged
TravisEz13 merged 91 commits intoPowerShell:masterfrom
kalgiz:shouldBeErrorId-Throw-replace
May 17, 2018
Merged

Convert ShouldBeErrorId to Should -Throw -ErrorId in PowerShell tests#6682
TravisEz13 merged 91 commits intoPowerShell:masterfrom
kalgiz:shouldBeErrorId-Throw-replace

Conversation

@kalgiz
Copy link
Contributor

@kalgiz kalgiz commented Apr 19, 2018

PR Summary

Convert ShouldBeErrorId to Should -Throw -ErrorId in PowerShell tests.
Get rid of try { } catch { } formula to assert that errors were thrown.
Small fixes in tests to obey the new Pester -Parameter syntax.

PR Checklist

kalgiz and others added 30 commits March 28, 2018 15:30
@iSazonov
Copy link
Collaborator

@TravisEz13 @adityapatwardhan Could you please review the PR - it is large and we catch merge conflicts every day.

try
{
get-childitem nosuchfile.nosuchextension -ea stop -ev err
get-childitem nosuchfile.nosuchextension -ErrorAction stop -ev err
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-ev should be changed to -ErrorVariable

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

if ($null -ne $breakpoint4) { Remove-PSBreakpoint $breakpoint4 }
get-module $moduleName | remove-module
if (Test-Path $moduleDirectory) { Remove-Item $moduleDirectory -r -force -ea silentlycontinue }
if (Test-Path $moduleDirectory) { Remove-Item $moduleDirectory -r -force -ErrorAction silentlycontinue }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-r should be -Recurse

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

It 'Import non existing culture is done correctly' {

import-localizedData mydata -uiculture nl-NL -ea SilentlyContinue -ev ev
import-localizedData mydata -uiculture nl-NL -ErrorAction SilentlyContinue -ev ev
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please expand -ev

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.


Context 'get-help helpFunc1 -component blah' {
$x = get-help helpFunc1 -component blah -ea SilentlyContinue -ev e
$x = get-help helpFunc1 -component blah -ErrorAction SilentlyContinue -ev e
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please expand -ev. Multiple instances in this file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

{ get-ciminstance -classname thisnameshouldnotexist -ErrorAction stop } |
=======
{ Get-CimInstance -ClassName thisnameshouldnotexist -ErrorAction Stop } |
>>>>>>> 500c8535507a723951462ec2d465b78aac36b3d8
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please correct rebase.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please correct rebase.

@TravisEz13
Copy link
Member

Can you push a commit with [feature] at the start of the title? thanks

@kalgiz
Copy link
Contributor Author

kalgiz commented May 16, 2018

@TravisEz13 I pushed the commit with [Feature]

@TravisEz13 TravisEz13 merged commit 2df9aac into PowerShell:master May 17, 2018
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.

4 participants