Revision: 613
Author: gtm.daemon
Date: Mon May 13 13:00:22 2013
Log: Added -[gtm_runUpToNSeconds:context:] to
GTMFoundationUnitTestingUtilities.
Many people were using -[gtm_runUpToSixtySecondsWithContext:] which was fine
until you started to see multiple failures in a single build and it could
take a
long time for a test pass to complete. 60 seconds is often much longer than
necessary to know that a failure condition has occurred.
DELTA=15 (15 added, 0 deleted, 0 changed)
http://code.google.com/p/google-toolbox-for-mac/source/detail?r=613
Modified:
/trunk/UnitTesting/GTMFoundationUnitTestingUtilities.h
/trunk/UnitTesting/GTMFoundationUnitTestingUtilities.m
=======================================
--- /trunk/UnitTesting/GTMFoundationUnitTestingUtilities.h Wed Aug 15
05:00:29 2012
+++ /trunk/UnitTesting/GTMFoundationUnitTestingUtilities.h Mon May 13
13:00:22 2013
@@ -91,8 +91,17 @@
- (BOOL)gtm_runUntilDate:(NSDate *)date
context:(id<GTMUnitTestingRunLoopContext>)context;
+// Calls -gtm_runUntilDate:mode:context: with mode set to
NSDefaultRunLoopMode,
+// and the timeout date set to |seconds| seconds.
+- (BOOL)gtm_runUpToNSeconds:(NSTimeInterval)seconds
+ context:(id<GTMUnitTestingRunLoopContext>)context;
+
// Calls -gtm_runUntilDate:mode:context: with mode set to
NSDefaultRunLoopMode,
// and the timeout date set to 60 seconds.
+// This is a good time to use for AppleEvent calls (which default to 60
seconds)
+// but may be a bit long for standard unit tests, and could cause a long
unit
+// testing run if you have multiple failures.
+// Calling -[gtm_runUpToNSeconds:context:] is preferred.
-
(BOOL)gtm_runUpToSixtySecondsWithContext:(id<GTMUnitTestingRunLoopContext>)context;
@end
=======================================
--- /trunk/UnitTesting/GTMFoundationUnitTestingUtilities.m Wed Aug 15
05:00:29 2012
+++ /trunk/UnitTesting/GTMFoundationUnitTestingUtilities.m Mon May 13
13:00:22 2013
@@ -80,6 +80,12 @@
@end
@implementation NSRunLoop (GTMUnitTestingAdditions)
+
+- (BOOL)gtm_runUpToNSeconds:(NSTimeInterval)seconds
+ context:(id<GTMUnitTestingRunLoopContext>)context {
+ return [self gtm_runUntilDate:[NSDate
dateWithTimeIntervalSinceNow:seconds]
+ context:context];
+}
-
(BOOL)gtm_runUpToSixtySecondsWithContext:(id<GTMUnitTestingRunLoopContext>)context
{
return [self gtm_runUntilDate:[NSDate dateWithTimeIntervalSinceNow:60]