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

AreEqualCaseFailMsg is currently dead code that is never reached #4471

Closed
Youssef1313 opened this issue Dec 30, 2024 · 1 comment · Fixed by #4525
Closed

AreEqualCaseFailMsg is currently dead code that is never reached #4471

Youssef1313 opened this issue Dec 30, 2024 · 1 comment · Fixed by #4525

Comments

@Youssef1313
Copy link
Member

Youssef1313 commented Dec 30, 2024

string finalMessage = !ignoreCase && CompareInternal(expected, actual, ignoreCase, culture) == 0
? string.Format(
CultureInfo.CurrentCulture,
FrameworkMessages.AreEqualCaseFailMsg,
userMessage,
ReplaceNulls(expected),
ReplaceNulls(actual))
: string.Format(
CultureInfo.CurrentCulture,
FrameworkMessages.AreEqualFailMsg,
userMessage,
ReplaceNulls(expected),
ReplaceNulls(actual));

At this point, CompareInternal(expected, actual, ignoreCase, culture) == 0 is clearly always false.

The corrected code would be CompareInternal(expected, actual, ignoreCase: true, culture) == 0. The original intent seems to produce a specialized message if the comparison isn't ignoring case, but expected and actual are differing by casing only.

@Evangelink Do you think we should follow the original intent? Or just keep the current behavior and delete the dead code?

AB#2331939

@Youssef1313
Copy link
Member Author

Let's fix after #4476 is merged to avoid annoying merge conflicts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant