-
-
Notifications
You must be signed in to change notification settings - Fork 476
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
"Should Be" should regard casing when comparing strings #107
Comments
I can see why this bothers you, but I am afraid making this change would brake a lot of tests for a lot of people. String comparisons in PowerShell are case insensitive, unless you use the -c* operators (like -ceq, -cmatch etc.). So assuming the same behaviour for Pester tests seems valid. That said having an option to make the assertion case sensitive is definitely missing. It can see this implemented as another Pester "keyword", the best fit is probably Exactly. 't' | Should Be 't' # pass
'T' | Should Be 't' # pass
't' | Should Be Exactly 'T' # fail
't' | Should Be Exactly 't' # pass This would work great for string comparisons, but could be a bit confusing when used with another types of input: 1.0 | Should Be 1 # pass
1.0 | Should Be Exactly 1 # pass Both tests pass, but the first value doesn't look exactly the same, what is going on? What do you think? |
I see you point. That was one alternative I was initially searching for in Pester when I first encountered this bahavoir. I emailed Scott about this and he thought it was a regression bug. |
To be frank I am surprised how little the change actually brakes. Only one of the Pester tests failed. But that is of course irrelevant, because the tests other people could have created is what matters here. |
PR #112 to add this feature for Be, Match and Contain |
Implemented for Be, Match and Contain. Enjoy! |
Right now they both succeed.
The text was updated successfully, but these errors were encountered: