diff options
author | Marek Safar <marek.safar@gmail.com> | 2017-08-18 16:02:16 +0300 |
---|---|---|
committer | Marek Safar <marek.safar@gmail.com> | 2017-08-18 17:50:26 +0300 |
commit | 90ad20a615da3066519aad3d85ee9f1466140cb6 (patch) | |
tree | 52f1967eb54cddf6179b43efd955b4d87ff62bff /linker | |
parent | a8d0bbe7e6503dd1798a99b785d18aaaaea34d28 (diff) |
Don't throw during test cases build process (most runner cannot handle it)
Diffstat (limited to 'linker')
-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; |