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

C# -> VB: various fixes #533

Merged
merged 17 commits into from
Mar 5, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions Tests/TestData/SelfVerifyingTests/CSToVB/StringEqualityTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,17 @@ public class StringEqualityTests
private char[] emptyCharArray = new char[0];

[Fact]
public void NullEmptyStringEqualsOperator() => Assert.False(nullString == emptyString);
public void NonInternStringsEqualsOperator() {
string a = "10";
string b = 10.ToString(); //strings created in runtime are not interned
Assert.True(a == b);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, I like this test, it shows that op_Equality is overridden and distinguishes from reference equality (which neither VB or C# does, but someone might guess from "==")


[Fact]
public void NullEmptyStringEqualsOperator() => Assert.False((emptyString != null && nullString != null) && emptyString == nullString); //null == string.Empty in VB

[Fact]
public void NullEmptyStringNotEqualsOperator() => Assert.True(nullString != emptyString);
public void NullEmptyStringNotEqualsOperator() => Assert.True((emptyString == null && nullString != null) || (emptyString != null && nullString == null)); //null == string.Empty in VB

[Fact]
public void NullEmptyObjectEqualsOperator() => Assert.False(nullObject == emptyString);
Expand Down