Skip to content
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

Compatibility tests: Use correct test cases object and remove invalid test case #1440

Merged
merged 1 commit into from
Apr 16, 2020

Conversation

bergmeister
Copy link
Collaborator

@bergmeister bergmeister commented Apr 13, 2020

PR Summary

The $genericVerCases test case object was not being used due to what seems to have been a copy-paste error.
One test case actually did not work because having a version string with not dot would throw here

I could add the following negative test for it but was wondering why we cannot make it accept single character versions?

        It "Does not parse version string '7' due to missing dot" {
            { [Microsoft.PowerShell.CrossCompatibility.PowerShellVersion] '7' } | Should -Throw
        }

In the case of PowerShell Core we wouldn't even need our own implementation and just use System.Management.Automation.SemanticVersion, which can actually parse versions without a dot.

PR Checklist

@bergmeister bergmeister changed the title Compatibility tests: Use correct genericVerCases test cases and remove invalid test case Compatibility tests: Use correct test cases object and remove invalid test case Apr 13, 2020
@rjmholt
Copy link
Contributor

rjmholt commented Apr 13, 2020

I could add the following negative test for it but was wondering why we cannot make it accept single character versions?

I think that's worth doing.

That class exists to allow JSON serialisation of versions across PowerShell versions, so it's not really necessary in the tests.

Thanks for fixing this @bergmeister!

@bergmeister
Copy link
Collaborator Author

OK, I will merge this and open a 2nd PR later to add the capability of parsing a single character version

@bergmeister bergmeister merged commit 03aa085 into master Apr 16, 2020
@bergmeister bergmeister deleted the bergmeister-patch-1 branch April 17, 2020 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants