Shorter error message for failed assertions
Posted: Wed May 12, 2010 9:00 am
Is it possible to get a shorter error message for failed assertions? Like just the number of the line that failed, and maybe the parameters?
Discussion about the Cobra programming language.
http://cobra-language.com/forums/
class A
def even(a as int) as bool is shared
test
assert .even(2) == true
assert .even(3) == true
assert .even(4) == true
body
return a % 2 == 0
def main
pass
Running 6 tests at 5/12/2010 10:18:16 PM
>> lib aaa, Version=0.0.0.0
>> class A
>> test 1: .even
Fail with exception:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. --->
Cobra.Lang.AssertException:
sourceSite = F:\Documents and Settings\john\Desktop\aaa.cobra:5 in A.test_Even for object A (RuntimeType)
info = nil
this = A (RuntimeType)
(.even(3) == true) = false
.even(3) = false
at A.test_Even()
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig,
MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAt
tributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[
] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[
] parameters, CultureInfo culture)
at Cobra.Lang.Test.MethodInfoTest._run(TestRunParams params)
at Cobra.Lang.Test.Test.Run(TestRunParams params, ITestRunListener listener)
<< test 1: .even
<< class A
>> lib Cobra.Lang, Version=0.8.0.1, Culture=neutral, PublicKeyToken=0a4783a5c7c9616e
>> class Cobra.Lang.TestIEnumerableExtensions
>> test 2: class level
<< test 2: class level
<< class Cobra.Lang.TestIEnumerableExtensions
>> class Cobra.Lang.TestIListExtensions
>> test 3: class level
<< test 3: class level
<< class Cobra.Lang.TestIListExtensions
>> class Cobra.Lang.TestIDictionaryExtensions
>> test 4: class level
<< test 4: class level
<< class Cobra.Lang.TestIDictionaryExtensions
>> class Cobra.Lang.ObjectCatalog
>> test 5: class level
<< test 5: class level
<< class Cobra.Lang.ObjectCatalog
>> class Cobra.Lang.TestSet
>> test 6: class level
<< test 6: class level
<< class Cobra.Lang.TestSet
<< lib Cobra.Lang, Version=0.8.0.1, Culture=neutral, PublicKeyToken=0a4783a5c7c9616e
<< lib aaa, Version=0.0.0.0
Finished at 5/12/2010 10:18:16 PM.
6 tests run in 00:00:00.3906250.
5 successes.
1 failure.
Line 5, assert failed: expected true, got false.