diff options
Diffstat (limited to 'linker/Tests/TestCasesRunner/TestCaseCollector.cs')
-rw-r--r-- | linker/Tests/TestCasesRunner/TestCaseCollector.cs | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/linker/Tests/TestCasesRunner/TestCaseCollector.cs b/linker/Tests/TestCasesRunner/TestCaseCollector.cs index c84ff3534..9545e0061 100644 --- a/linker/Tests/TestCasesRunner/TestCaseCollector.cs +++ b/linker/Tests/TestCasesRunner/TestCaseCollector.cs @@ -70,22 +70,29 @@ namespace Mono.Linker.Tests.TestCasesRunner { var typeDefinition = FindTypeDefinition (caseAssemblyDefinition, potentialCase); - if (typeDefinition == null) - throw new InvalidOperationException ($"Could not find the matching type for test case {sourceFile}. Ensure the file name and class name match"); + testCase = null; + + if (typeDefinition == null) { + Console.WriteLine ($"Could not find the matching type for test case {sourceFile}. Ensure the file name and class name match"); + return false; + } if (typeDefinition.HasAttribute (nameof (NotATestCaseAttribute))) { - testCase = null; return false; } // Verify the class as a static main method var mainMethod = typeDefinition.Methods.FirstOrDefault (m => m.Name == "Main"); - if (mainMethod == null) - throw new InvalidOperationException ($"{typeDefinition} in {sourceFile} is missing a Main() method"); + if (mainMethod == null) { + Console.WriteLine ($"{typeDefinition} in {sourceFile} is missing a Main() method"); + return false; + } - if (!mainMethod.IsStatic) - throw new InvalidOperationException ($"The Main() method for {typeDefinition} in {sourceFile} should be static"); + if (!mainMethod.IsStatic) { + Console.WriteLine ($"The Main() method for {typeDefinition} in {sourceFile} should be static"); + return false; + } testCase = potentialCase; return true; |