From 4e9121bd288134b2fd8e3760d47d99c7c45a2bcd Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Tue, 13 Nov 2018 20:19:05 +0100 Subject: [PATCH] Add test case for #1304. --- .../TestCases/Correctness/Loops.cs | 13 +++++++++++++ .../TestCases/ILPretty/Issue959.cs | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Correctness/Loops.cs b/ICSharpCode.Decompiler.Tests/TestCases/Correctness/Loops.cs index da2685955..4f79d5850 100644 --- a/ICSharpCode.Decompiler.Tests/TestCases/Correctness/Loops.cs +++ b/ICSharpCode.Decompiler.Tests/TestCases/Correctness/Loops.cs @@ -79,6 +79,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness Console.WriteLine(NoForeachDueToMultipleCurrentAccess(new List { 1, 2, 3, 4, 5 })); Console.WriteLine(NoForeachCallWithSideEffect(new CustomClassEnumeratorWithIDisposable())); LoopWithGotoRepeat(); + Console.WriteLine("LoopFollowedByIf: {0}", LoopFollowedByIf()); } public static void ForWithMultipleVariables() @@ -246,5 +247,17 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness } Console.WriteLine("after finally"); } + + private static int LoopFollowedByIf() + { + int num = 0; + while (num == 0) { + num++; + } + if (num == 0) { + return -1; + } + return num; + } } } diff --git a/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Issue959.cs b/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Issue959.cs index c9fc8ee2a..cee558bc4 100644 --- a/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Issue959.cs +++ b/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Issue959.cs @@ -4,7 +4,7 @@ { public void Test(bool arg) { - switch (arg) { + if (!arg && arg) { } }