Skip to content

Commit

Permalink
Update StringNonOrdinalTests.cs
Browse files Browse the repository at this point in the history
Update tests to match changes from previous commit.
  • Loading branch information
hamarb123 authored Jan 15, 2025
1 parent 6f47bb1 commit 3c41b8e
Showing 1 changed file with 22 additions and 28 deletions.
50 changes: 22 additions & 28 deletions hamarb123.Analyzers.Test/StringNonOrdinal/StringNonOrdinalTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,18 @@ public void M(string str, S1 s1)
str.Contains("");
str.EndsWith('\0');
{|#2:str.EndsWith("")|};
{|#3:str.Equals("")|};
{|#4:string.Equals(str, "")|};
str.Equals("");
string.Equals(str, "");
str.IndexOf('\0');
{|#5:str.IndexOf("")|};
{|#3:str.IndexOf("")|};
str.LastIndexOf('\0');
{|#6:str.LastIndexOf("")|};
{|#7:str.StartsWith("")|};
{|#4:str.LastIndexOf("")|};
{|#5:str.StartsWith("")|};
str.StartsWith('\0');
_ = str == "";
s1.EndsWith("");
{|#8:str.IndexOf("", 0)|};
{|#6:str.IndexOf("", 0)|};
str.EndsWith("", true, null);
str.EndsWith("", StringComparison.Ordinal);
}
Expand All @@ -55,17 +55,14 @@ public struct S1
var expected0 = VerifyCS.Diagnostic("HAM0004").WithLocation(0).WithArguments("Compare");
var expected1 = VerifyCS.Diagnostic("HAM0004").WithLocation(1).WithArguments("CompareTo");
var expected2 = VerifyCS.Diagnostic("HAM0004").WithLocation(2).WithArguments("EndsWith");
var expected3 = VerifyCS.Diagnostic("HAM0004").WithLocation(3).WithArguments("Equals");
var expected4 = VerifyCS.Diagnostic("HAM0004").WithLocation(4).WithArguments("Equals");
var expected5 = VerifyCS.Diagnostic("HAM0004").WithLocation(5).WithArguments("IndexOf");
var expected6 = VerifyCS.Diagnostic("HAM0004").WithLocation(6).WithArguments("LastIndexOf");
var expected7 = VerifyCS.Diagnostic("HAM0004").WithLocation(7).WithArguments("StartsWith");
var expected8 = VerifyCS.Diagnostic("HAM0004").WithLocation(8).WithArguments("IndexOf");
var expected5 = VerifyCS.Diagnostic("HAM0004").WithLocation(3).WithArguments("IndexOf");
var expected6 = VerifyCS.Diagnostic("HAM0004").WithLocation(4).WithArguments("LastIndexOf");
var expected7 = VerifyCS.Diagnostic("HAM0004").WithLocation(5).WithArguments("StartsWith");
var expected8 = VerifyCS.Diagnostic("HAM0004").WithLocation(6).WithArguments("IndexOf");

await VerifyCS.VerifyAnalyzerAsync(source,
expected0, expected1, expected2, expected3,

Check failure on line 64 in hamarb123.Analyzers.Test/StringNonOrdinal/StringNonOrdinalTests.cs

View workflow job for this annotation

GitHub Actions / build

The name 'expected3' does not exist in the current context

Check failure on line 64 in hamarb123.Analyzers.Test/StringNonOrdinal/StringNonOrdinalTests.cs

View workflow job for this annotation

GitHub Actions / build

The name 'expected3' does not exist in the current context

Check failure on line 64 in hamarb123.Analyzers.Test/StringNonOrdinal/StringNonOrdinalTests.cs

View workflow job for this annotation

GitHub Actions / package

The name 'expected3' does not exist in the current context

Check failure on line 64 in hamarb123.Analyzers.Test/StringNonOrdinal/StringNonOrdinalTests.cs

View workflow job for this annotation

GitHub Actions / package

The name 'expected3' does not exist in the current context
expected4, expected5, expected6, expected7,
expected8);
expected4, expected5, expected6);

Check failure on line 65 in hamarb123.Analyzers.Test/StringNonOrdinal/StringNonOrdinalTests.cs

View workflow job for this annotation

GitHub Actions / build

The name 'expected4' does not exist in the current context

Check failure on line 65 in hamarb123.Analyzers.Test/StringNonOrdinal/StringNonOrdinalTests.cs

View workflow job for this annotation

GitHub Actions / build

The name 'expected4' does not exist in the current context

Check failure on line 65 in hamarb123.Analyzers.Test/StringNonOrdinal/StringNonOrdinalTests.cs

View workflow job for this annotation

GitHub Actions / package

The name 'expected4' does not exist in the current context

Check failure on line 65 in hamarb123.Analyzers.Test/StringNonOrdinal/StringNonOrdinalTests.cs

View workflow job for this annotation

GitHub Actions / package

The name 'expected4' does not exist in the current context
}

[Fact]
Expand All @@ -83,18 +80,18 @@ Public Sub M(str As String, s1 As S1)
str.Contains("")
str.EndsWith(ChrW(0))
{|#2:str.EndsWith("")|}
{|#3:str.Equals("")|}
{|#4:string.Equals(str, "")|}
str.Equals("")
string.Equals(str, "")
str.IndexOf(ChrW(0))
{|#5:str.IndexOf("")|}
{|#3:str.IndexOf("")|}
str.LastIndexOf(ChrW(0))
{|#6:str.LastIndexOf("")|}
{|#7:str.StartsWith("")|}
{|#4:str.LastIndexOf("")|}
{|#5:str.StartsWith("")|}
str.StartsWith(ChrW(0))
Dim a = str = ""
s1.EndsWith("")
{|#8:str.IndexOf("", 0)|}
{|#6:str.IndexOf("", 0)|}
str.EndsWith("", True, Nothing)
str.EndsWith("", StringComparison.Ordinal)
End Sub
Expand All @@ -110,17 +107,14 @@ End Structure
var expected0 = VerifyVB.Diagnostic("HAM0004").WithLocation(0).WithArguments("Compare");
var expected1 = VerifyVB.Diagnostic("HAM0004").WithLocation(1).WithArguments("CompareTo");
var expected2 = VerifyVB.Diagnostic("HAM0004").WithLocation(2).WithArguments("EndsWith");
var expected3 = VerifyVB.Diagnostic("HAM0004").WithLocation(3).WithArguments("Equals");
var expected4 = VerifyVB.Diagnostic("HAM0004").WithLocation(4).WithArguments("Equals");
var expected5 = VerifyVB.Diagnostic("HAM0004").WithLocation(5).WithArguments("IndexOf");
var expected6 = VerifyVB.Diagnostic("HAM0004").WithLocation(6).WithArguments("LastIndexOf");
var expected7 = VerifyVB.Diagnostic("HAM0004").WithLocation(7).WithArguments("StartsWith");
var expected8 = VerifyVB.Diagnostic("HAM0004").WithLocation(8).WithArguments("IndexOf");
var expected5 = VerifyVB.Diagnostic("HAM0004").WithLocation(3).WithArguments("IndexOf");
var expected6 = VerifyVB.Diagnostic("HAM0004").WithLocation(4).WithArguments("LastIndexOf");
var expected7 = VerifyVB.Diagnostic("HAM0004").WithLocation(5).WithArguments("StartsWith");
var expected8 = VerifyVB.Diagnostic("HAM0004").WithLocation(6).WithArguments("IndexOf");

await VerifyVB.VerifyAnalyzerAsync(source,
expected0, expected1, expected2, expected3,

Check failure on line 116 in hamarb123.Analyzers.Test/StringNonOrdinal/StringNonOrdinalTests.cs

View workflow job for this annotation

GitHub Actions / build

The name 'expected3' does not exist in the current context

Check failure on line 116 in hamarb123.Analyzers.Test/StringNonOrdinal/StringNonOrdinalTests.cs

View workflow job for this annotation

GitHub Actions / build

The name 'expected3' does not exist in the current context

Check failure on line 116 in hamarb123.Analyzers.Test/StringNonOrdinal/StringNonOrdinalTests.cs

View workflow job for this annotation

GitHub Actions / package

The name 'expected3' does not exist in the current context

Check failure on line 116 in hamarb123.Analyzers.Test/StringNonOrdinal/StringNonOrdinalTests.cs

View workflow job for this annotation

GitHub Actions / package

The name 'expected3' does not exist in the current context
expected4, expected5, expected6, expected7,
expected8);
expected4, expected5, expected6);

Check failure on line 117 in hamarb123.Analyzers.Test/StringNonOrdinal/StringNonOrdinalTests.cs

View workflow job for this annotation

GitHub Actions / build

The name 'expected4' does not exist in the current context

Check failure on line 117 in hamarb123.Analyzers.Test/StringNonOrdinal/StringNonOrdinalTests.cs

View workflow job for this annotation

GitHub Actions / build

The name 'expected4' does not exist in the current context

Check failure on line 117 in hamarb123.Analyzers.Test/StringNonOrdinal/StringNonOrdinalTests.cs

View workflow job for this annotation

GitHub Actions / package

The name 'expected4' does not exist in the current context

Check failure on line 117 in hamarb123.Analyzers.Test/StringNonOrdinal/StringNonOrdinalTests.cs

View workflow job for this annotation

GitHub Actions / package

The name 'expected4' does not exist in the current context
}
}
}

0 comments on commit 3c41b8e

Please sign in to comment.