|
|
|
@ -102,11 +102,11 @@ namespace ICSharpCode.Decompiler.Tests
@@ -102,11 +102,11 @@ namespace ICSharpCode.Decompiler.Tests
|
|
|
|
|
RunWithOutput("Random Tests\\TestCases", "TestCase-1.exe"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void RunWithTest(string dir, string fileToRoundtrip, string fileToTest) |
|
|
|
|
void RunWithTest(string dir, string fileToRoundtrip, string fileToTest, string keyFile = null) |
|
|
|
|
{ |
|
|
|
|
RunInternal(dir, fileToRoundtrip, outputDir => RunTest(outputDir, fileToTest)); |
|
|
|
|
RunInternal(dir, fileToRoundtrip, outputDir => RunTest(outputDir, fileToTest), keyFile); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void RunWithOutput(string dir, string fileToRoundtrip) |
|
|
|
|
{ |
|
|
|
|
string inputDir = Path.Combine(TestDir, dir); |
|
|
|
@ -114,7 +114,7 @@ namespace ICSharpCode.Decompiler.Tests
@@ -114,7 +114,7 @@ namespace ICSharpCode.Decompiler.Tests
|
|
|
|
|
outputDir => Tester.RunAndCompareOutput(fileToRoundtrip, Path.Combine(inputDir, fileToRoundtrip), Path.Combine(outputDir, fileToRoundtrip))); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void RunInternal(string dir, string fileToRoundtrip, Action<string> testAction) |
|
|
|
|
void RunInternal(string dir, string fileToRoundtrip, Action<string> testAction, string snkFilePath = null) |
|
|
|
|
{ |
|
|
|
|
if (!Directory.Exists(TestDir)) { |
|
|
|
|
Assert.Ignore($"Assembly-roundtrip test ignored: test directory '{TestDir}' needs to be checked out separately." + Environment.NewLine + |
|
|
|
@ -152,6 +152,9 @@ namespace ICSharpCode.Decompiler.Tests
@@ -152,6 +152,9 @@ namespace ICSharpCode.Decompiler.Tests
|
|
|
|
|
decompiler.Settings = new DecompilerSettings(LanguageVersion.CSharp7_3); |
|
|
|
|
// use a fixed GUID so that we can diff the output between different ILSpy runs without spurious changes
|
|
|
|
|
decompiler.ProjectGuid = Guid.Parse("{127C83E4-4587-4CF9-ADCA-799875F3DFE6}"); |
|
|
|
|
if (snkFilePath != null) { |
|
|
|
|
decompiler.StrongNameKeyFile = Path.Combine(inputDir, snkFilePath); |
|
|
|
|
} |
|
|
|
|
decompiler.DecompileProject(module, decompiledDir); |
|
|
|
|
Console.WriteLine($"Decompiled {fileToRoundtrip} in {w.Elapsed.TotalSeconds:f2}"); |
|
|
|
|
projectFile = Path.Combine(decompiledDir, module.Name + ".csproj"); |
|
|
|
|