Permalink
Browse files

Updated examples

  • Loading branch information...
1 parent 6f6443b commit e078f8dfd61de6c9ea7a053d74fc851b74c7c4d9 @gabriel gabriel committed May 22, 2012
Showing with 335 additions and 185 deletions.
  1. +3 −4 Classes-MacOSX/UI/GHTestOutlineViewModel.h
  2. +2 −2 Classes-MacOSX/UI/GHTestOutlineViewModel.m
  3. +4 −4 Classes-MacOSX/UI/GHTestViewController.h
  4. +1 −1 Classes-MacOSX/UI/GHTestWindowController.h
  5. +1 −1 Classes/GHTest/GHTesting.m
  6. BIN Examples/MyTestable-MacOSX/Frameworks/GHUnit.framework/Versions/A/GHUnit
  7. +1 −1 Examples/MyTestable-MacOSX/Frameworks/GHUnit.framework/Versions/A/Headers/GHAsyncTestCase.h
  8. +3 −5 Examples/MyTestable-MacOSX/Frameworks/GHUnit.framework/Versions/A/Headers/GHTest.h
  9. +11 −2 Examples/MyTestable-MacOSX/Frameworks/GHUnit.framework/Versions/A/Headers/GHTestCase.h
  10. +4 −5 Examples/MyTestable-MacOSX/Frameworks/GHUnit.framework/Versions/A/Headers/GHTestGroup.h
  11. +3 −4 Examples/MyTestable-MacOSX/Frameworks/GHUnit.framework/Versions/A/Headers/GHTestOutlineViewModel.h
  12. +4 −4 Examples/MyTestable-MacOSX/Frameworks/GHUnit.framework/Versions/A/Headers/GHTestRunner.h
  13. +4 −4 Examples/MyTestable-MacOSX/Frameworks/GHUnit.framework/Versions/A/Headers/GHTestViewController.h
  14. +5 −5 Examples/MyTestable-MacOSX/Frameworks/GHUnit.framework/Versions/A/Headers/GHTestViewModel.h
  15. +1 −1 Examples/MyTestable-MacOSX/Frameworks/GHUnit.framework/Versions/A/Headers/GHTestWindowController.h
  16. +0 −5 Examples/MyTestable-MacOSX/Frameworks/GHUnit.framework/Versions/A/Headers/GHTesting.h
  17. BIN Examples/MyTestable-MacOSX/Frameworks/GHUnit.framework/Versions/A/Resources/GHTestView.nib
  18. +6 −6 Examples/MyTestable-MacOSX/Frameworks/GHUnit.framework/Versions/A/Resources/Info.plist
  19. +21 −46 Examples/MyTestable-MacOSX/GHUnitTestMain.m
  20. +7 −15 Examples/MyTestable-MacOSX/MyTestable-MacOSX.xcodeproj/project.pbxproj
  21. BIN Examples/MyTestable-iOS/GHUnitIOS.framework/Versions/A/GHUnitIOS
  22. +1 −1 Examples/MyTestable-iOS/GHUnitIOS.framework/Versions/A/Headers/GHAsyncTestCase.h
  23. +12 −34 ...SLocale+Mock.h → MyTestable-iOS/GHUnitIOS.framework/Versions/A/Headers/GHMockNSHTTPURLResponse.h}
  24. +167 −0 Examples/MyTestable-iOS/GHUnitIOS.framework/Versions/A/Headers/GHMockNSURLConnection.h
  25. +3 −5 Examples/MyTestable-iOS/GHUnitIOS.framework/Versions/A/Headers/GHTest.h
  26. +2 −2 Examples/MyTestable-iOS/GHUnitIOS.framework/Versions/A/Headers/GHTestCase.h
  27. +4 −5 Examples/MyTestable-iOS/GHUnitIOS.framework/Versions/A/Headers/GHTestGroup.h
  28. +4 −4 Examples/MyTestable-iOS/GHUnitIOS.framework/Versions/A/Headers/GHTestRunner.h
  29. +5 −5 Examples/MyTestable-iOS/GHUnitIOS.framework/Versions/A/Headers/GHTestViewModel.h
  30. +0 −5 Examples/MyTestable-iOS/GHUnitIOS.framework/Versions/A/Headers/GHTesting.h
  31. +41 −0 Examples/MyTestable-iOS/GHUnitIOS.framework/Versions/A/Headers/GHUIImageViewControl.h
  32. +5 −5 Examples/MyTestable-iOS/GHUnitIOS.framework/Versions/A/Headers/GHUnitIOSTestView.h
  33. +1 −1 Examples/MyTestable-iOS/GHUnitIOS.framework/Versions/A/Headers/GHUnitIOSViewController.h
  34. +7 −0 Examples/MyTestable-iOS/MyTestable.xcodeproj/project.pbxproj
  35. +0 −2 Project-MacOSX/GHUnitMacOSX.xcodeproj/project.pbxproj
  36. +1 −1 Tests/GHTestLogTest.m
  37. +1 −0 XcodeConfig/GHUnit.xcconfig
@@ -22,12 +22,11 @@
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 // on lines like this to not confuse IB
<NSOutlineViewDelegate, NSOutlineViewDataSource>
#endif
-{
- id<GHTestOutlineViewModelDelegate> delegate_; // weak
-
+{
+ __unsafe_unretained id<GHTestOutlineViewModelDelegate> delegate_;
NSButtonCell *editCell_;
}
-@property ( nonatomic) id<GHTestOutlineViewModelDelegate> delegate;
+@property (unsafe_unretained, nonatomic) id<GHTestOutlineViewModelDelegate> delegate;
@end
@@ -10,7 +10,7 @@
@implementation GHTestOutlineViewModel
-@synthesize delegate=delegate_;
+@synthesize delegate;
#pragma mark DataSource (NSOutlineView)
@@ -115,7 +115,7 @@ - (NSCell *)outlineView:(NSOutlineView *)outlineView dataCellForTableColumn:(NST
#pragma mark Delegates (NSOutlineView)
- (void)outlineViewSelectionDidChange:(NSNotification *)notification {
- [delegate_ testOutlineViewModelDidChangeSelection:self];
+ [self.delegate testOutlineViewModelDidChangeSelection:self];
}
- (BOOL)outlineView:(NSOutlineView *)outlineView shouldSelectItem:(id)item {
@@ -63,14 +63,14 @@
@property (readonly, nonatomic) id<GHTest> selectedTest;
@property (readonly, nonatomic) GHTestOutlineViewModel *dataSource;
-@property ( nonatomic) NSString *status;
+@property (strong, nonatomic) NSString *status;
@property (assign, nonatomic) double statusProgress;
-@property ( nonatomic) NSString *runLabel;
+@property (strong, nonatomic) NSString *runLabel;
-@property ( nonatomic) GHTestSuite *suite;
+@property (strong, nonatomic) GHTestSuite *suite;
@property (assign, nonatomic, getter=isRunning) BOOL running;
-@property ( nonatomic) NSString *exceptionFilename;
+@property (strong, nonatomic) NSString *exceptionFilename;
@property (assign, nonatomic) NSInteger exceptionLineNumber;
@property (assign, nonatomic) BOOL reraiseExceptions;
@@ -33,7 +33,7 @@
GHTestViewController *viewController_;
}
-@property ( nonatomic) IBOutlet GHTestViewController *viewController;
+@property (strong, nonatomic) IBOutlet GHTestViewController *viewController;
- (IBAction)runTests:(id)sender;
- (IBAction)copy:(id)sender;
@@ -62,7 +62,7 @@ NSInteger ClassSort(id a, id b, void *context) {
// GTM_BEGIN
// Used for sorting methods below
-static int MethodSort(id a, id b, void *context) {
+static NSInteger MethodSort(id a, id b, void *context) {
NSInvocation *invocationA = a;
NSInvocation *invocationB = b;
const char *nameA = sel_getName([invocationA selector]);
@@ -89,7 +89,7 @@ enum {
Run loop modes to run while waiting;
Defaults to NSDefaultRunLoopMode, NSRunLoopCommonModes, NSConnectionReplyMode
*/
-@property (retain, nonatomic) NSArray *runLoopModes;
+@property (strong, nonatomic) NSArray *runLoopModes;
/*!
Prepare before calling the asynchronous method.
@@ -52,7 +52,7 @@ typedef NSInteger GHTestOptions;
Generate string from GHTestStatus
@param status
*/
-extern NSString* NSStringFromGHTestStatus(GHTestStatus status);
+extern NSString *NSStringFromGHTestStatus(GHTestStatus status);
/*!
Check if test is running (or trying to cancel).
@@ -229,8 +229,6 @@ extern NSString *NSStringFromGHTestStats(GHTestStats stats);
*/
@interface GHTest : NSObject <GHTest, GHTestCaseLogWriter> {
- NSObject<GHTestDelegate> *delegate_; // weak
-
id target_;
SEL selector_;
@@ -246,9 +244,9 @@ extern NSString *NSStringFromGHTestStats(GHTestStats stats);
}
-@property (readonly, nonatomic) id target;
+@property (readonly, strong, nonatomic) id target;
@property (readonly, nonatomic) SEL selector;
-@property (readonly, nonatomic) NSArray *log;
+@property (readonly, strong, nonatomic) NSArray *log;
/*!
Create test with identifier, name.
@@ -92,14 +92,14 @@
*/
@interface GHTestCase : NSObject {
- id<GHTestCaseLogWriter> logWriter_; // weak
+ id<GHTestCaseLogWriter> __unsafe_unretained logWriter_; // weak
SEL currentSelector_;
}
//! The current test selector
@property (assign, nonatomic) SEL currentSelector;
-@property (assign, nonatomic) id<GHTestCaseLogWriter> logWriter;
+@property (unsafe_unretained, nonatomic) id<GHTestCaseLogWriter> logWriter;
// GTM_BEGIN
//! Run before each test method
@@ -149,4 +149,13 @@
*/
- (void)log:(NSString *)message;
+/*!
+ Whether the test class should be run as a part of command line tests.
+ By default this is NO. Subclasses can override this method to disable
+ test classes that are problematic at the command line.
+
+ @result YES if this test class is disabled for command line tests
+ */
+- (BOOL)isCLIDisabled;
+
@end
@@ -75,8 +75,7 @@
*/
@interface GHTestGroup : NSObject <GHTestDelegate, GHTestGroup> {
- NSObject<GHTestDelegate> *delegate_; // weak
- id<GHTestGroup> parent_; // weak
+ id<GHTestGroup> __unsafe_unretained parent_; // weak
NSMutableArray */*of id<GHTest>*/children_;
@@ -96,9 +95,9 @@
NSException *exception_; // If exception happens in group setUpClass/tearDownClass
}
-@property (readonly, nonatomic) NSArray */*of id<GHTest>*/children;
-@property (assign, nonatomic) id<GHTestGroup> parent;
-@property (readonly, nonatomic) id testCase;
+@property (readonly, strong, nonatomic) NSArray */*of id<GHTest>*/children;
+@property (unsafe_unretained, nonatomic) id<GHTestGroup> parent;
+@property (readonly, strong, nonatomic) id testCase;
@property (assign, nonatomic) GHTestOptions options;
/*!
@@ -22,12 +22,11 @@
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 // on lines like this to not confuse IB
<NSOutlineViewDelegate, NSOutlineViewDataSource>
#endif
-{
- id<GHTestOutlineViewModelDelegate> delegate_; // weak
-
+{
+ __unsafe_unretained id<GHTestOutlineViewModelDelegate> delegate_;
NSButtonCell *editCell_;
}
-@property (assign, nonatomic) id<GHTestOutlineViewModelDelegate> delegate;
+@property (unsafe_unretained, nonatomic) id<GHTestOutlineViewModelDelegate> delegate;
@end
@@ -130,7 +130,7 @@
id<GHTest> test_; // The test to run; Could be a GHTestGroup (suite), GHTestGroup (test case), or GHTest (target/selector)
- NSObject<GHTestRunnerDelegate> *delegate_; // weak
+ NSObject<GHTestRunnerDelegate> *__unsafe_unretained delegate_; // weak
GHTestOptions options_;
@@ -142,14 +142,14 @@
NSOperationQueue *operationQueue_; //! If running a suite in operation queue
}
-@property (retain) id<GHTest> test;
-@property (assign) NSObject<GHTestRunnerDelegate> *delegate;
+@property (strong) id<GHTest> test;
+@property (unsafe_unretained) NSObject<GHTestRunnerDelegate> *delegate;
@property (assign) GHTestOptions options;
@property (readonly) GHTestStats stats;
@property (readonly, getter=isRunning) BOOL running;
@property (readonly, getter=isCancelling) BOOL cancelling;
@property (readonly) NSTimeInterval interval;
-@property (retain, nonatomic) NSOperationQueue *operationQueue;
+@property (strong, nonatomic) NSOperationQueue *operationQueue;
@property (assign, nonatomic, getter=isInParallel) BOOL inParallel;
/*!
@@ -63,14 +63,14 @@
@property (readonly, nonatomic) id<GHTest> selectedTest;
@property (readonly, nonatomic) GHTestOutlineViewModel *dataSource;
-@property (retain, nonatomic) NSString *status;
+@property (strong, nonatomic) NSString *status;
@property (assign, nonatomic) double statusProgress;
-@property (retain, nonatomic) NSString *runLabel;
+@property (strong, nonatomic) NSString *runLabel;
-@property (retain, nonatomic) GHTestSuite *suite;
+@property (strong, nonatomic) GHTestSuite *suite;
@property (assign, nonatomic, getter=isRunning) BOOL running;
-@property (retain, nonatomic) NSString *exceptionFilename;
+@property (strong, nonatomic) NSString *exceptionFilename;
@property (assign, nonatomic) NSInteger exceptionLineNumber;
@property (assign, nonatomic) BOOL reraiseExceptions;
@@ -173,16 +173,16 @@ typedef enum {
NSMutableArray */*of GHTestNode*/children_;
NSMutableArray */* of GHTestNode*/filteredChildren_;
- id<GHTestNodeDelegate> delegate_;
+ id<GHTestNodeDelegate> __unsafe_unretained delegate_;
GHTestNodeFilter filter_;
NSString *textFilter_;
}
-@property (readonly, nonatomic) NSArray */* of GHTestNode*/children;
-@property (readonly, nonatomic) id<GHTest> test;
-@property (assign, nonatomic) id<GHTestNodeDelegate> delegate;
+@property (readonly, strong, nonatomic) NSArray */* of GHTestNode*/children;
+@property (readonly, strong, nonatomic) id<GHTest> test;
+@property (unsafe_unretained, nonatomic) id<GHTestNodeDelegate> delegate;
@property (assign, nonatomic) GHTestNodeFilter filter;
-@property (retain, nonatomic) NSString *textFilter;
+@property (strong, nonatomic) NSString *textFilter;
- (id)initWithTest:(id<GHTest>)test children:(NSArray */*of id<GHTest>*/)children source:(GHTestViewModel *)source;
+ (GHTestNode *)nodeWithTest:(id<GHTest>)test children:(NSArray */*of id<GHTest>*/)children source:(GHTestViewModel *)source;
@@ -33,7 +33,7 @@
GHTestViewController *viewController_;
}
-@property (retain, nonatomic) IBOutlet GHTestViewController *viewController;
+@property (strong, nonatomic) IBOutlet GHTestViewController *viewController;
- (IBAction)runTests:(id)sender;
- (IBAction)copy:(id)sender;
@@ -51,11 +51,6 @@
#import <Foundation/Foundation.h>
#import "GHUnit.h"
-#ifdef __cplusplus
-extern "C" NSString *GHUStackTraceFromException(NSException *e);
-#else
-extern NSString *GHUStackTraceFromException(NSException *e);
-#endif
// GTM_BEGIN
BOOL isTestFixtureOfClass(Class aClass, Class testCaseClass);
@@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
- <string>11C74</string>
+ <string>11E53</string>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
@@ -21,21 +21,21 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
- <string>0.4.32</string>
+ <string>0.5.1</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
- <string>4D199</string>
+ <string>4E2002</string>
<key>DTPlatformVersion</key>
<string>GM</string>
<key>DTSDKBuild</key>
- <string>11C63</string>
+ <string>11D50a</string>
<key>DTSDKName</key>
<string>macosx10.7</string>
<key>DTXcode</key>
- <string>0420</string>
+ <string>0432</string>
<key>DTXcodeBuild</key>
- <string>4D199</string>
+ <string>4E2002</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2011 rel.me. All rights reserved.</string>
</dict>
@@ -32,52 +32,27 @@
#import <GHUnit/GHUnit.h>
#import <GHUnit/GHTestApp.h>
-// Default exception handler
-void exceptionHandler(NSException *exception) {
- NSLog(@"%@\n%@", [exception reason], GHUStackTraceFromException(exception));
-}
-
int main(int argc, char *argv[]) {
-
- /*!
- Default: Set to:
- NSDebugEnabled NO "YES"
- NSZombieEnabled NO "YES"
- NSDeallocateZombies NO "YES"
- NSHangOnUncaughtException NO "YES"
-
- NSEnableAutoreleasePool YES "NO"
- NSAutoreleaseFreedObjectCheckEnabled NO "YES"
- NSAutoreleaseHighWaterMark 0 non-negative integer
- NSAutoreleaseHighWaterResolution 0 non-negative integer
-
- For info on these varaiables see NSDebug.h; http://theshadow.uw.hu/iPhoneSDKdoc/Foundation.framework/NSDebug.h.html
-
- For malloc debugging see: http://developer.apple.com/mac/library/documentation/Performance/Conceptual/ManagingMemory/Articles/MallocDebug.html
- */
- NSSetUncaughtExceptionHandler(&exceptionHandler);
-
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-
- // Register any special test case classes
- //[[GHTesting sharedInstance] registerClassName:@"GHSpecialTestCase"];
-
- int retVal = 0;
- // If GHUNIT_CLI is set we are using the command line interface and run the tests
- // Otherwise load the GUI app
- if (getenv("GHUNIT_CLI")) {
- retVal = [GHTestRunner run];
- } else {
- // To run all tests (from ENV)
- GHTestApp *app = [[GHTestApp alloc] init];
- // To run a different test suite:
- //GHTestSuite *suite = [GHTestSuite suiteWithTestFilter:@"GHSlowTest,GHAsyncTestCaseTest"];
- //GHTestApp *app = [[GHTestApp alloc] initWithSuite:suite];
- // Or set global:
- //GHUnitTest = @"GHSlowTest";
- [NSApp run];
- [app release];
+ @autoreleasepool {
+
+ // Register any special test case classes
+ //[[GHTesting sharedInstance] registerClassName:@"GHSpecialTestCase"];
+
+ int retVal = 0;
+ // If GHUNIT_CLI is set we are using the command line interface and run the tests
+ // Otherwise load the GUI app
+ if (getenv("GHUNIT_CLI")) {
+ retVal = [GHTestRunner run];
+ } else {
+ // To run all tests (from ENV)
+ GHTestApp *app = [[GHTestApp alloc] init];
+ // To run a different test suite:
+ //GHTestSuite *suite = [GHTestSuite suiteWithTestFilter:@"GHSlowTest,GHAsyncTestCaseTest"];
+ //GHTestApp *app = [[GHTestApp alloc] initWithSuite:suite];
+ // Or set global:
+ //GHUnitTest = @"GHSlowTest";
+ [NSApp run];
+ }
+ return retVal;
}
- [pool release];
- return retVal;
}
Oops, something went wrong.

0 comments on commit e078f8d

Please sign in to comment.