Improve test logging.

pull/1/head
Matthew Chen 7 years ago
parent 79ed05133c
commit c6ef7f18e7

@ -13,7 +13,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)setUp
{
NSLog(@"%@ setUp", self.logTag);
OWSLogInfo(@"");
[super setUp];
@ -29,7 +29,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)tearDown
{
NSLog(@"%@ tearDown", self.logTag);
OWSLogInfo(@"");
[super tearDown];
}

@ -156,7 +156,7 @@ NS_ASSUME_NONNULL_BEGIN
[self waitForExpectationsWithTimeout:5.0
handler:^(NSError *error) {
if (error) {
NSLog(@"Timeout Error: %@", error);
OWSLogInfo(@"Timeout Error: %@", error);
}
}];
}

@ -103,7 +103,7 @@
NSDateFormatter *formatter = [NSDateFormatter new];
formatter.dateStyle = NSDateFormatterLongStyle;
formatter.timeStyle = NSDateFormatterLongStyle;
NSLog(@"now: %@", [formatter stringFromDate:now]);
OWSLogInfo(@"now: %@", [formatter stringFromDate:now]);
NSDate *oneSecondAgo =
[NSDate dateWithTimeIntervalSinceReferenceDate:[now timeIntervalSinceReferenceDate] - kSecondInterval];
@ -135,7 +135,7 @@
NSDate *twoYearsAhead =
[NSDate dateWithTimeIntervalSinceReferenceDate:[now timeIntervalSinceReferenceDate] + kYearInterval * 2];
NSLog(@"oneSecondAgo: %@", [formatter stringFromDate:oneSecondAgo]);
OWSLogInfo(@"oneSecondAgo: %@", [formatter stringFromDate:oneSecondAgo]);
XCTAssertTrue([DateUtil dateIsToday:oneSecondAgo now:now]);
XCTAssertTrue([DateUtil dateIsToday:oneMinuteAgo now:now]);
@ -236,13 +236,13 @@
formatter.timeStyle = NSDateFormatterLongStyle;
NSDate *yesterdayBeforeMidnight = [self dateWithYear:2015 month:8 day:10 hour:23 minute:55];
NSLog(@"yesterdayBeforeMidnight: %@", [formatter stringFromDate:yesterdayBeforeMidnight]);
OWSLogInfo(@"yesterdayBeforeMidnight: %@", [formatter stringFromDate:yesterdayBeforeMidnight]);
NSDate *todayAfterMidnight = [self dateWithYear:2015 month:8 day:11 hour:0 minute:5];
NSLog(@"todayAfterMidnight: %@", [formatter stringFromDate:todayAfterMidnight]);
OWSLogInfo(@"todayAfterMidnight: %@", [formatter stringFromDate:todayAfterMidnight]);
NSDate *todayNoon = [self dateWithYear:2015 month:8 day:11 hour:12 minute:0];
NSLog(@"todayNoon: %@", [formatter stringFromDate:todayNoon]);
OWSLogInfo(@"todayNoon: %@", [formatter stringFromDate:todayNoon]);
// Before Midnight, after Midnight.
XCTAssertFalse([DateUtil dateIsToday:yesterdayBeforeMidnight now:todayAfterMidnight]);

@ -12,27 +12,27 @@ NS_ASSUME_NONNULL_BEGIN
- (void)receivedOffer:(SSKProtoCallMessageOffer *)offer fromCallerId:(NSString *)callerId
{
NSLog(@"%s", __PRETTY_FUNCTION__);
OWSLogInfo(@"");
}
- (void)receivedAnswer:(SSKProtoCallMessageAnswer *)answer fromCallerId:(NSString *)callerId
{
NSLog(@"%s", __PRETTY_FUNCTION__);
OWSLogInfo(@"");
}
- (void)receivedIceUpdate:(SSKProtoCallMessageIceUpdate *)iceUpdate fromCallerId:(NSString *)callerId
{
NSLog(@"%s", __PRETTY_FUNCTION__);
OWSLogInfo(@"");
}
- (void)receivedHangup:(SSKProtoCallMessageHangup *)hangup fromCallerId:(NSString *)callerId
{
NSLog(@"%s", __PRETTY_FUNCTION__);
OWSLogInfo(@"");
}
- (void)receivedBusy:(SSKProtoCallMessageBusy *)busy fromCallerId:(NSString *)callerId
{
NSLog(@"%s", __PRETTY_FUNCTION__);
OWSLogInfo(@"");
}
@end

@ -11,7 +11,7 @@ NS_ASSUME_NONNULL_BEGIN
//- (nullable SignalRecipient *)synchronousLookup:(NSString *)identifier error:(NSError **)error
//{
// NSLog(@"[OWSFakeContactsUpdater] Faking contact lookup.");
// OWSLogInfo(@"[OWSFakeContactsUpdater] Faking contact lookup.");
// return [[SignalRecipient alloc] initWithTextSecureIdentifier:@"fake-recipient-id"
// relay:nil];
//}

@ -14,22 +14,22 @@ NS_ASSUME_NONNULL_BEGIN
inThread:(TSThread *)thread
contactsManager:(id<ContactsManagerProtocol>)contactsManager
transaction:(YapDatabaseReadTransaction *)transaction {
NSLog(@"%s", __PRETTY_FUNCTION__);
OWSLogInfo(@"");
}
- (void)notifyUserForErrorMessage:(TSErrorMessage *)error
thread:(TSThread *)thread
transaction:(YapDatabaseReadWriteTransaction *)transaction {
NSLog(@"%s", __PRETTY_FUNCTION__);
OWSLogInfo(@"");
}
- (void)notifyUserForThreadlessErrorMessage:(TSErrorMessage *)error
transaction:(YapDatabaseReadWriteTransaction *)transaction {
NSLog(@"%s", __PRETTY_FUNCTION__);
OWSLogInfo(@"");
}
- (void)clearAllNotifications {
NSLog(@"%s", __PRETTY_FUNCTION__);
OWSLogInfo(@"");
}
@end

@ -20,7 +20,7 @@
success:(void (^)())successCallback
failure:(void (^)(NSError *))failureCallback
{
NSLog(@"faking successful provisioning");
OWSLogInfo(@"faking successful provisioning");
successCallback();
}
@ -35,7 +35,7 @@
- (void)requestProvisioningCodeWithSuccess:(void (^)(NSString *))successCallback
failure:(void (^)(NSError *))failureCallback
{
NSLog(@"faking successful provisioning code fetching");
OWSLogInfo(@"faking successful provisioning code fetching");
successCallback(@"fake-provisioning-code");
}
@ -90,7 +90,7 @@
[self waitForExpectationsWithTimeout:5.0
handler:^(NSError *error) {
if (error) {
NSLog(@"Timeout Error: %@", error);
OWSLogInfo(@"Timeout Error: %@", error);
}
}];
}

@ -86,7 +86,7 @@ NS_ASSUME_NONNULL_BEGIN
[self waitForExpectationsWithTimeout:5
handler:^(NSError *error) {
NSLog(@"No message submitted.");
OWSLogInfo(@"No message submitted.");
}];
}

@ -54,7 +54,7 @@ NS_ASSUME_NONNULL_BEGIN
forRecipient:(SignalRecipient *)recipient
inThread:(TSThread *)thread
{
NSLog(@"[OWSFakeMessagesManager] Faking deviceMessages.");
OWSLogInfo(@"[OWSFakeMessagesManager] Faking deviceMessages.");
return @[];
}
@ -298,7 +298,7 @@ NS_ASSUME_NONNULL_BEGIN
[self waitForExpectationsWithTimeout:5
handler:^(NSError *error) {
NSLog(@"Expiration timer not set in time.");
OWSLogInfo(@"Expiration timer not set in time.");
}];
}
@ -324,7 +324,7 @@ NS_ASSUME_NONNULL_BEGIN
[self waitForExpectationsWithTimeout:5
handler:^(NSError *error) {
NSLog(@"Expiration timer not set in time.");
OWSLogInfo(@"Expiration timer not set in time.");
}];
}

@ -7,6 +7,9 @@
#import "SSKEnvironment.h"
#import "TestAppContext.h"
@import CocoaLumberjack;
#import <CocoaLumberjack/DDTTYLogger.h>
NS_ASSUME_NONNULL_BEGIN
#ifdef DEBUG
@ -15,10 +18,12 @@ NS_ASSUME_NONNULL_BEGIN
- (void)setUp
{
NSLog(@"%@ setUp", self.logTag);
OWSLogInfo(@"%@ setUp", self.logTag);
[super setUp];
[DDLog addLogger:DDTTYLogger.sharedInstance];
ClearCurrentAppContextForTests();
SetCurrentAppContext([TestAppContext new]);
@ -27,7 +32,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)tearDown
{
NSLog(@"%@ tearDown", self.logTag);
OWSLogInfo(@"%@ tearDown", self.logTag);
[super tearDown];
}

@ -4,6 +4,7 @@
import XCTest
import SignalServiceKit
import CocoaLumberjack
@objc
public class SSKBaseTestSwift: XCTestCase {
@ -12,6 +13,8 @@ public class SSKBaseTestSwift: XCTestCase {
public override func setUp() {
super.setUp()
DDLog.add(DDTTYLogger.sharedInstance)
ClearCurrentAppContextForTests()
SetCurrentAppContext(TestAppContext())

Loading…
Cancel
Save