Skip to content

Commit 485f6ae

Browse files
committed
Recharacterize switch/select tests and fix TestFileRewriter path for Linux
- Remove blank lines before `default:` and post-switch `return` that the converter doesn't actually emit - Fix TestFileRewriter path separator (backslash → forward slash, add missing level) so recharacterization works on Linux
1 parent 3fa0e5f commit 485f6ae

File tree

2 files changed

+2
-14
lines changed

2 files changed

+2
-14
lines changed

Tests/CSharp/ExpressionTests/ExpressionTests.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2086,7 +2086,6 @@ public void OnLoad(UserInterface? ui)
20862086
case UserInterface.Wisdom:
20872087
activity = 3;
20882088
break;
2089-
20902089
default:
20912090
activity = 4;
20922091
break;
@@ -2301,7 +2300,6 @@ public int OnLoad()
23012300
}
23022301
23032302
break;
2304-
23052303
default:
23062304
if (true)
23072305
{
@@ -2363,7 +2361,6 @@ public void S()
23632361
case var case3 when Operators.ConditionalCompareObjectGreater(case3, 4, false):
23642362
j = 4;
23652363
break;
2366-
23672364
default:
23682365
j = -1;
23692366
break;

Tests/CSharp/StatementTests/MethodStatementTests.cs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.Threading.Tasks;
1+
using System.Threading.Tasks;
22
using ICSharpCode.CodeConverter.Tests.TestRunners;
33
using Xunit;
44

@@ -1051,7 +1051,6 @@ private void TestMethod(int number)
10511051
case 5:
10521052
Console.Write(""section 5"");
10531053
break;
1054-
10551054
default:
10561055
Console.Write(""default section"");
10571056
break;
@@ -1089,7 +1088,6 @@ public static string TimeAgo(int daysAgo)
10891088
return ""this week"";
10901089
case > 0:
10911090
return daysAgo / 7 + "" weeks ago"";
1092-
10931091
default:
10941092
return ""in the future"";
10951093
}
@@ -1131,9 +1129,7 @@ public static bool IsPrivileged(UserLevel level)
11311129
switch (level)
11321130
{
11331131
case var @case when (int)UserLevel.City_Staff <= (int)@case && (int)@case <= (int)UserLevel.Fixity_ROOT:
1134-
{
1135-
return true;
1136-
}
1132+
return true;
11371133
}
11381134
return false;
11391135
}
@@ -1173,7 +1169,6 @@ public static string TimeAgo(string x)
11731169
return ""c"";
11741170
case ""d"":
11751171
return ""d"";
1176-
11771172
default:
11781173
return ""e"";
11791174
}
@@ -1226,7 +1221,6 @@ public bool CanDoWork(object Something)
12261221
case object _ when Something is int:
12271222
// Do something with the Integer
12281223
return true;
1229-
12301224
default:
12311225
// Do something else
12321226
return false;
@@ -1270,7 +1264,6 @@ public void DoesNotThrow()
12701264
break;
12711265
case > 4:
12721266
break;
1273-
12741267
default:
12751268
throw new Exception();
12761269
}
@@ -1588,7 +1581,6 @@ private static double d1mach(int i)
15881581
case 2:
15891582
return double.MaxValue; // the largest magnitude.
15901583
}
1591-
15921584
return 0d;
15931585
}
15941586
}");
@@ -1623,7 +1615,6 @@ private static string Describe(int i)
16231615
case 2:
16241616
return ""two"";
16251617
}
1626-
16271618
return null;
16281619
}
16291620
}");

0 commit comments

Comments
 (0)