Browse Source

Move NotUsingBlock test.

pull/863/head
Daniel Grunwald 8 years ago
parent
commit
10f44d3541
  1. 28
      ICSharpCode.Decompiler.Tests/NotUsingBlock.cs
  2. 16
      ICSharpCode.Decompiler.Tests/TestCases/Correctness/ControlFlow.cs

28
ICSharpCode.Decompiler.Tests/NotUsingBlock.cs

@ -1,28 +0,0 @@ @@ -1,28 +0,0 @@
using System;
using System.IO;
namespace ICSharpCode.Decompiler.Tests
{
public class NotUsingBlock
{
public void ThisIsNotAUsingBlock()
{
object obj = File.OpenRead("...");
IDisposable disposable;
try
{
(obj as FileStream).WriteByte(2);
Console.WriteLine("some text");
}
finally
{
disposable = (obj as IDisposable);
if (disposable != null)
{
disposable.Dispose();
}
}
Console.WriteLine(disposable);
}
}
}

16
ICSharpCode.Decompiler.Tests/TestCases/Correctness/ControlFlow.cs

@ -41,6 +41,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness @@ -41,6 +41,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness
BreakUnlessContinue(true);
BreakUnlessContinue(false);
TestConditionals();
ThisIsNotAUsingBlock();
return 0;
}
@ -149,5 +150,20 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness @@ -149,5 +150,20 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness
byte answer = (byte)(value == 128 ? 255 : 0);
return answer;
}
static void ThisIsNotAUsingBlock()
{
object obj = new System.IO.StringWriter();
IDisposable disposable;
try {
(obj as System.IO.TextWriter).WriteLine("ThisIsNotAUsingBlock");
} finally {
disposable = (obj as IDisposable);
if (disposable != null) {
disposable.Dispose();
}
}
Console.WriteLine(disposable);
}
}
}
Loading…
Cancel
Save