Browse Source

#1869: Add correctness test case

pull/1880/head
Siegfried Pammer 6 years ago
parent
commit
60490a4369
  1. 14
      ICSharpCode.Decompiler.Tests/TestCases/Correctness/Loops.cs

14
ICSharpCode.Decompiler.Tests/TestCases/Correctness/Loops.cs

@ -80,6 +80,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness @@ -80,6 +80,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness
Console.WriteLine(NoForeachCallWithSideEffect(new CustomClassEnumeratorWithIDisposable<int>()));
LoopWithGotoRepeat();
Console.WriteLine("LoopFollowedByIf: {0}", LoopFollowedByIf());
NoForeachDueToVariableAssignment();
}
public static void ForWithMultipleVariables()
@ -277,5 +278,18 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness @@ -277,5 +278,18 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness
}
}
}
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);
}
}
}
}

Loading…
Cancel
Save