-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
Create unit tests for Calculator plugin #6356
Conversation
Labels needed to cover this :
It can be reviewed by the core team |
src/modules/launcher/Plugins/Microsoft.Plugin.Calculator/CalculateEngine.cs
Outdated
Show resolved
Hide resolved
src/modules/launcher/Plugins/Microsoft.Plugin.Calculator/CalculateEngine.cs
Outdated
Show resolved
Hide resolved
src/modules/launcher/Plugins/Microsoft.Plugin.Calculator/CalculateHelper.cs
Outdated
Show resolved
Hide resolved
...dules/launcher/Plugins/Microsoft.Plugin.Calculator.UnitTest/ExtendedCalculatorParserTests.cs
Outdated
Show resolved
Hide resolved
@P-Storm On first glance this looks fantastic! Thanks for this PR 👍 . I'll take a deeper look this morning |
...dules/launcher/Plugins/Microsoft.Plugin.Calculator.UnitTest/ExtendedCalculatorParserTests.cs
Show resolved
Hide resolved
src/modules/launcher/Plugins/Microsoft.Plugin.Calculator/CalculateHelper.cs
Outdated
Show resolved
Hide resolved
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.
This is a terrific PR, much appreciated. Other than the one nit comment. The only thing I'd ask is that you add the Microsoft.Plugin.Caclulator.UnitTest project to run in CI by adding it to the .net core tests specified here. This will allow us to validate that these tests run for everyone and prevent future breaking changes.
testAssemblyVer2: | |
…. Validates complexer cases now.
I guess all the feedback is processed. If there is some questions about the new class |
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.
LGTM! Thanks for the Robustness on the BracketHelper class 👍 Also I can see that the tests are passing in CI now 💯
Summary of the Pull Request
Currently the calculator plugin for PowerToys Run had no unit test (see #5948). With this in place we can test the calculation engine separate. Currently I have also included the problems of #3488 and #3697
PR Checklist
Info on Pull Request
I have made a start with the unit test. I had to change to structure of the parsing to a separate class. The culture is needed to mimmick the current output and for the unittest to be system agnostic.
Note:
Unit test
ParseValuesKnownIssues
has known bug unit tested. These are the limitations of tehI did search for some test that were failing before the latest fix and put them into
ParseValues
.Validation Steps Performed
Startup the unit test project
Microsoft.Plugin.Calculator.UnitTest
insrc\modules\launcher\Plugins\Microsoft.Plugin.Calculator.UnitTest\Microsoft.Plugin.Calculator.UnitTest.csproj
Please note that this is the first time contributing for PowerToys. If there is something missing, please let me know 👍