Skip to content

Conversation

@Tadas
Copy link
Contributor

@Tadas Tadas commented Jun 17, 2017

Fixes #3991

@msftclas
Copy link

@Tadas,
Thanks for your contribution.
To ensure that the project team has proper rights to use your work, please complete the Contribution License Agreement at https://cla.microsoft.com.

It will cover your contributions to all Microsoft-managed open source projects.
Thanks,
Microsoft Pull Request Bot

@msftclas
Copy link

@Tadas, thanks for signing the contribution license agreement. We will now validate the agreement and then the pull request.

Thanks, Microsoft Pull Request Bot

$watch = [System.Diagnostics.Stopwatch]::StartNew()
Start-Sleep -ms 1000
$watch.Stop()
$watch.ElapsedMilliseconds | Should BeGreaterThan 950
Copy link
Member

Choose a reason for hiding this comment

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

Seems like you should also make sure it's less than 1050

Copy link
Collaborator

@iSazonov iSazonov Jun 17, 2017

Choose a reason for hiding this comment

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

Should we test parameter aliases? It seems it is a general feature and we should test the feature in special tests but not every cmdlet and every alias.

Copy link
Member

Choose a reason for hiding this comment

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

In general, we should validate the alias is correct, but shouldn't repeat every test for the parameter and its alias. -ms is a pretty simple case, so it's hard to not repeat the test (using -TestCases is probably better here). For parameters with more complex behavior, I think it would be sufficient if some cases used the parameter while others used the alias.

Copy link
Contributor

Choose a reason for hiding this comment

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

@iSazonov - As a matter of principle - we avoid testing the parameter binder in cmdlet specific tests.

Personally I don't ask for any tests for an alias - the test isn't covering any new code, but I understand the concerns of those asking for the test, so I don't complain about it either.

Copy link
Collaborator

Choose a reason for hiding this comment

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

If we're worried about parameter's aliases, we could make a common test for all of them, just like we did for the cmdlets and their aliases as < cmdlet, parameter, alias, platform(?) >.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's not a big problem, people mostly never remove code anyway and if they did, it should be caught during the PR, but it's a nice idea.

@Tadas
Copy link
Contributor Author

Tadas commented Jun 17, 2017

What about the Describe "Start-Sleep" -Tags "CI" { test, isn't it redundant?

@daxian-dbw daxian-dbw merged commit 437d773 into PowerShell:master Jun 19, 2017
@iSazonov
Copy link
Collaborator

@Tadas Thanks for your contribution!

@Tadas Tadas deleted the start-sleep-ms-alias branch June 25, 2017 19:38
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.

6 participants