Skip to content
Permalink
Browse files

#1869: Add correctness test case

  • Loading branch information
siegfriedpammer committed Dec 28, 2019
1 parent 0adfefa commit 60490a4369984a62edacd273bf487ae530300cda
Showing with 14 additions and 0 deletions.
  1. +14 −0 ICSharpCode.Decompiler.Tests/TestCases/Correctness/Loops.cs
@@ -80,6 +80,7 @@ static void Main()
Console.WriteLine(NoForeachCallWithSideEffect(new CustomClassEnumeratorWithIDisposable<int>()));
LoopWithGotoRepeat();
Console.WriteLine("LoopFollowedByIf: {0}", LoopFollowedByIf());
NoForeachDueToVariableAssignment();
}

public static void ForWithMultipleVariables()
@@ -277,5 +278,18 @@ static void Issue1392ForWithNestedSwitchPlusGoto()
}
}
}

private static void NoForeachDueToVariableAssignment()
{
try {
int[] array = new int[] { 1, 2, 3 };
for (int i = 0; i < array.Length; i++) {
Console.WriteLine(array[i]);
array = null;
}
} catch (Exception ex) {
Console.WriteLine(ex.GetType() + ": " + ex.Message);
}
}
}
}

0 comments on commit 60490a4

Please sign in to comment.
You can’t perform that action at this time.