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

Issue adding check without VersionChange #2

Open
micah686 opened this issue Feb 13, 2021 · 1 comment
Open

Issue adding check without VersionChange #2

micah686 opened this issue Feb 13, 2021 · 1 comment

Comments

@micah686
Copy link

Related to PR #1 , I have a question on how I should proceed with a PR.

I added the following code to CompareVersions

          //....  
          github = NormalizeVersionString(github);



            var currentValid = Version.TryParse(current, out var currentVersion);
            var githubValid = Version.TryParse(github, out var githubVersion);
            bool validVersion = currentValid && githubValid;

            if (validVersion && cmpType != CompareType.Boolean && changeLevel <= VersionChange.Revision)
            {
                return currentVersion < githubVersion;
            }
            else
            {
                // choose CompareType specific compare method
                switch (cmpType)
                {
                    case CompareType.Incremental:
                        return CompareVersionsIncremental(current, github, changeLevel);

                    // boolean is fallback, because it accepts the widest range of input
                    case CompareType.Boolean:
                    default:
                        return CompareVersionsBoolean(current, github);
                }
            }

However, your test TestExceedLocalDepth() checks for a false value if the Version Change is Minor, but since my code change checks against the whole version, it returns true, causing the test to fail. Do you have any suggestions how I can modify the changes to make sure it passes the tests?

@Mayerch1
Copy link
Owner

I'm not entirely sure.

What do you think about modifying NormalizeVersionString.
A new parameter VersionChange could cut off all unused decimals in the version, using some regex or similiar.

However this takes away some of the parsing capabilities of the Version class.

But I don't see another way of solving this, as this is an important behaviour (not updating in that test case)

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

No branches or pull requests

2 participants