Ticket #195: test-fail.patch
File test-fail.patch, 2.1 KB (added by hopscc, 15 years ago) |
---|
-
Source/Cobra.Lang/CobraCore.cobra
138 138 Run all Cobra `test` sections in all assemblies using reflection to locate them. 139 139 """ 140 140 # start = DateTime.now 141 _runAllTests(Assembly.getEntryAssembly, Dictionary<of String, String>()) 141 if not _runAllTests(Assembly.getEntryAssembly, Dictionary<of String, String>()) 142 CobraCore.exit(3) 142 143 # duration = DateTime.now.subtract(start) 143 144 # trace duration 144 145 145 def _runAllTests(ass as Assembly, found as Dictionary<of String, String>) # CC: found should be Set<of String>146 def _runAllTests(ass as Assembly, found as Dictionary<of String, String>) as bool # CC: found should be Set<of String> 146 147 name = ass.getName.toString 147 148 if found.containsKey(name) 148 return 149 return true 149 150 found.add(name, name) 150 151 if _skipAssemblyNameForTesting(name) # saves some time 151 return 152 return true 152 153 153 154 # print 'Testing assembly:', ass 154 155 for type in ass.getExportedTypes … … 161 162 # potential solution 1: move type test out of the type into a "sister" type: private __FooTest 162 163 # potential solution 2: require a constructed type in Cobra: `test Foo<of int> ...` and then put that in a method attribute in the gen C# and use that type 163 164 continue 164 method.invoke(type, nil) 165 165 try 166 method.invoke(type, nil) 167 catch exc as Exception 168 print '** Test Failure: Exception in Test clause' 169 print exc.innerException 170 result = false 166 171 # traverse further assemblies 167 172 for assName in ass.getReferencedAssemblies 168 173 subAss = Assembly.load(assName) 169 _runAllTests(subAss to !, found) 170 174 result = _runAllTests(subAss to !, found) and result 175 return result 176 171 177 var _skipPrefixes = @['System.', 'Mono.', 'mscorlib,', 'System,'] 172 178 173 179 def _skipAssemblyNameForTesting(name as String) as bool … … 176 182 return true 177 183 return false 178 184 179 180 185 ## Detailed stack trace 181 186 182 187 pro maxStackFrames as int