Skip to content
This repository
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 49 lines (36 sloc) 1.745 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
#import "CDRColorizedReporter.h"

static const char * const ANSI_NORMAL = "\033[0m";
static const char * const ANSI_RED = "\033[0;40;31m";
static const char * const ANSI_GREEN = "\033[0;40;32m";
static const char * const ANSI_YELLOW = "\033[0;40;33m";
static const char * const ANSI_CYAN = "\033[0;40;36m";

@implementation CDRColorizedReporter

#pragma mark Protected interface
- (NSString *)successToken {
    return [NSString stringWithFormat:@"%s%@%s", ANSI_GREEN, [super successToken], ANSI_NORMAL];
}

- (NSString *)pendingToken {
    return [NSString stringWithFormat:@"%s%@%s", ANSI_YELLOW, [super pendingToken], ANSI_NORMAL];
}

- (NSString *)pendingMessageForExample:(CDRExample *)example {
    return [NSString stringWithFormat:@"%s%@%s", ANSI_YELLOW, [super pendingMessageForExample:example], ANSI_NORMAL];
}

- (NSString *)skippedToken {
    return [NSString stringWithFormat:@"%s%@%s", ANSI_CYAN, [super skippedToken], ANSI_NORMAL];
}

- (NSString *)skippedMessageForExample:(CDRExample *)example {
    return [NSString stringWithFormat:@"%s%@%s", ANSI_CYAN, [super skippedMessageForExample:example], ANSI_NORMAL];
}

- (NSString *)failureToken {
    return [NSString stringWithFormat:@"%s%@%s", ANSI_RED, [super failureToken], ANSI_NORMAL];
}

- (NSString *)failureMessageForExample:(CDRExample *)example {
    return [NSString stringWithFormat:@"%s%@%s", ANSI_RED, [super failureMessageForExample:example], ANSI_NORMAL];
}

- (NSString *)errorToken {
    return [NSString stringWithFormat:@"%s%@%s", ANSI_RED, [super errorToken], ANSI_NORMAL];
}

- (NSString *)errorMessageForExample:(CDRExample *)example {
    return [NSString stringWithFormat:@"%s%@%s", ANSI_RED, [super errorMessageForExample:example], ANSI_NORMAL];
}

@end
Something went wrong with that request. Please try again.