Objective-J Test API 0.1.0
Frameworks/OJUnit/OJTestListenerText.j
Go to the documentation of this file.
00001 @import <Foundation/Foundation.j>
00002 
00003 stream = require("narwhal/term").stream;
00004 
00005 @implementation OJTestListenerText : CPObject
00006 {
00007     CPArray _errors;
00008     CPArray _failures;
00009 }
00010 
00011 - (id)init
00012 {
00013     self = [super init];
00014 
00015     _errors = [];
00016     _failures = [];
00017 
00018     return self;
00019 }
00020 
00021 - (void)addError:(CPException)anException forTest:(OJTest)aTest
00022 {
00023         CPLog.warn("[OJTestListenerText addError:forTest:] is deprecated. Please use [OJTestListener addError:].");
00024         [self addError:[[OJTestFailure alloc] initWithTest:aTest exception:anException]];
00025 }
00026 
00027 - (void)addError:(OJTestFailure)error
00028 {
00029     _errors.push(error);
00030     
00031     stream.print("\n\0red(addError test="+[error description]+"\0)");
00032     stream.print("\n\0red("+[error trace]+"\0)");
00033 }
00034 
00035 - (CPArray)errors
00036 {
00037     return _errors;
00038 }
00039 
00040 - (void)addFailure:(CPException)anException forTest:(OJTest)aTest
00041 {
00042         CPLog.warn("[OJTestListenerText addFailure:forTest:] is deprecated. Please use [OJTestListener addFailure:].");
00043         [self addFailure:[[OJTestFailure alloc] initWithTest:aTest exception:anException]];
00044 }
00045 
00046 - (void)addFailure:(OJTestFailure)failure
00047 {
00048     _failures.push(failure);
00049 
00050     stream.print("\n\0yellow(addFailure test="+[failure description]+"\0)");
00051     stream.print("\n\0yellow("+[failure trace]+"\0)");
00052 }
00053 
00054 - (CPArray)failures
00055 {
00056     return _failures;
00057 }
00058 
00059 - (void)startTest:(OJTest)aTest
00060 {
00061     system.stderr.write(".").flush();
00062     CPLog.info("startTest  test="+[aTest description]);
00063 }
00064 
00065 - (void)endTest:(OJTest)aTest
00066 {
00067     CPLog.info("endTest    test="+[aTest description]);
00068 }
00069 
00070 @end
 All Classes Files Functions Variables