diff --git a/ICSharpCode.Decompiler/Tests/InitializerTests.cs b/ICSharpCode.Decompiler/Tests/InitializerTests.cs index a4ab57fbf..8240a6aef 100644 --- a/ICSharpCode.Decompiler/Tests/InitializerTests.cs +++ b/ICSharpCode.Decompiler/Tests/InitializerTests.cs @@ -532,9 +532,9 @@ public class InitializerTests }); } - public void MultidimensionalInit() + public int[,] MultidimensionalInit() { - int[,] expr_09 = new int[, ] + return new int[, ] { { @@ -651,9 +651,9 @@ public class InitializerTests }; } - public void MultidimensionalInit2() + public int[][,] MultidimensionalInit2() { - int[][,] array = new int[][,] + return new int[][,] { new int[, ] { @@ -785,9 +785,9 @@ public class InitializerTests }; } - public void ArrayOfArrayOfArrayInit() + public int[][,,] ArrayOfArrayOfArrayInit() { - int[][,,] array = new int[][,,] + return new int[][,,] { new int[, , ] { diff --git a/ICSharpCode.Decompiler/Tests/TestRunner.cs b/ICSharpCode.Decompiler/Tests/TestRunner.cs index d63bb8e8b..a45a874d7 100644 --- a/ICSharpCode.Decompiler/Tests/TestRunner.cs +++ b/ICSharpCode.Decompiler/Tests/TestRunner.cs @@ -55,7 +55,7 @@ namespace ICSharpCode.Decompiler.Tests [Test] public void ExceptionHandling() { - TestFile(@"..\..\Tests\ExceptionHandling.cs"); + TestFile(@"..\..\Tests\ExceptionHandling.cs", false); } [Test] @@ -155,9 +155,15 @@ namespace ICSharpCode.Decompiler.Tests } static void TestFile(string fileName) + { + TestFile(fileName, false); + TestFile(fileName, true); + } + + static void TestFile(string fileName, bool optimize) { string code = File.ReadAllText(fileName); - AssemblyDefinition assembly = Compile(code); + AssemblyDefinition assembly = Compile(code, optimize); AstBuilder decompiler = new AstBuilder(new DecompilerContext(assembly.MainModule)); decompiler.AddAssembly(assembly); new Helpers.RemoveCompilerAttribute().Run(decompiler.CompilationUnit); @@ -166,11 +172,11 @@ namespace ICSharpCode.Decompiler.Tests CodeAssert.AreEqual(code, output.ToString()); } - static AssemblyDefinition Compile(string code) + static AssemblyDefinition Compile(string code, bool optimize) { CSharpCodeProvider provider = new CSharpCodeProvider(new Dictionary { { "CompilerVersion", "v4.0" } }); CompilerParameters options = new CompilerParameters(); - options.CompilerOptions = "/unsafe /o-"; + options.CompilerOptions = "/unsafe /o" + (optimize ? "+" : "-"); options.ReferencedAssemblies.Add("System.Core.dll"); CompilerResults results = provider.CompileAssemblyFromSource(options, code); try {