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

Open
Youssef1313 opened this issue Dec 30, 2024 · 1 comment
Open

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

@Youssef1313 Youssef1313 self-assigned this Dec 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant