Skip to content

Commit ec7e85c

Browse files
committed
Add test for C#→VB relational pattern conversion (issue #803)
Tests that C# 9 switch statement relational patterns (case < 0:) convert correctly to VB Case Is < 0 clauses, addressing the missing test noted in code review. https://claude.ai/code/session_01AkwUvu3XuCdj3D4axoX4UX
1 parent dc08ad9 commit ec7e85c

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

Tests/VB/StatementTests.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1282,6 +1282,34 @@ End Function
12821282
End Class");
12831283
}
12841284

1285+
[Fact]
1286+
public async Task SelectCase_WithRelationalPatternAsync()
1287+
{
1288+
await TestConversionCSharpToVisualBasicAsync(@"class TestClass
1289+
{
1290+
public void Classify(int n)
1291+
{
1292+
switch (n) {
1293+
case < 0:
1294+
System.Console.Write(""negative"");
1295+
break;
1296+
case >= 0:
1297+
System.Console.Write(""non-negative"");
1298+
break;
1299+
}
1300+
}
1301+
}", @"Friend Class TestClass
1302+
Public Sub Classify(n As Integer)
1303+
Select Case n
1304+
Case Is < 0
1305+
System.Console.Write(""negative"")
1306+
Case Is >= 0
1307+
System.Console.Write(""non-negative"")
1308+
End Select
1309+
End Sub
1310+
End Class");
1311+
}
1312+
12851313
[Fact]
12861314
public async Task TryCatchAsync()
12871315
{

0 commit comments

Comments
 (0)