PageRenderTime 24ms CodeModel.GetById 14ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/GHUnitIOS.framework/Versions/A/Headers/GHTesting.h

http://github.com/zwaldowski/BlocksKit
C++ Header | 151 lines | 27 code | 22 blank | 102 comment | 0 complexity | 745a22d3c44bd66bbb6aac133d8a9017 MD5 | raw file
  1//
  2//  GHTesting.h
  3//  GHUnit
  4//
  5//  Created by Gabriel Handford on 1/30/09.
  6//  Copyright 2008 Gabriel Handford
  7//
  8//  Permission is hereby granted, free of charge, to any person
  9//  obtaining a copy of this software and associated documentation
 10//  files (the "Software"), to deal in the Software without
 11//  restriction, including without limitation the rights to use,
 12//  copy, modify, merge, publish, distribute, sublicense, and/or sell
 13//  copies of the Software, and to permit persons to whom the
 14//  Software is furnished to do so, subject to the following
 15//  conditions:
 16//
 17//  The above copyright notice and this permission notice shall be
 18//  included in all copies or substantial portions of the Software.
 19//
 20//  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 21//  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 22//  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 23//  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 24//  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 25//  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 26//  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 27//  OTHER DEALINGS IN THE SOFTWARE.
 28//
 29
 30//! @cond DEV
 31
 32//
 33// Portions of this file fall under the following license, marked with:
 34// GTM_BEGIN : GTM_END
 35//
 36//  Copyright 2008 Google Inc.
 37//
 38//  Licensed under the Apache License, Version 2.0 (the "License"); you may not
 39//  use this file except in compliance with the License.  You may obtain a copy
 40//  of the License at
 41// 
 42//  http://www.apache.org/licenses/LICENSE-2.0
 43// 
 44//  Unless required by applicable law or agreed to in writing, software
 45//  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 46//  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
 47//  License for the specific language governing permissions and limitations under
 48//  the License.
 49//
 50
 51#import <Foundation/Foundation.h>
 52#import "GHUnit.h"
 53
 54#ifdef __cplusplus
 55extern "C" NSString *GHUStackTraceFromException(NSException *e);
 56#else
 57extern NSString *GHUStackTraceFromException(NSException *e);
 58#endif
 59
 60// GTM_BEGIN
 61BOOL isTestFixtureOfClass(Class aClass, Class testCaseClass);
 62// GTM_END
 63
 64/*! 
 65 Utility test for loading and running tests.
 66 @note Much of this is borrowed from GTM/UnitTesting.
 67 */
 68@interface GHTesting : NSObject { 
 69
 70  NSMutableArray/* of NSString*/ *testCaseClassNames_;
 71  
 72}
 73
 74/*!
 75 The shared testing instance.
 76 */
 77+ (GHTesting *)sharedInstance;
 78
 79/*!
 80 Load all test classes that we can "see".
 81 @result Array of initialized (and autoreleased) test case classes in an autoreleased array.
 82 */
 83- (NSArray *)loadAllTestCases;
 84
 85/*!
 86 Load tests from target.
 87 @result Array of id<GHTest>
 88 */
 89- (NSArray *)loadTestsFromTarget:(id)target;
 90
 91/*!
 92 See if class is of a registered test case class.
 93 */
 94- (BOOL)isTestCaseClass:(Class)aClass;
 95
 96/*!
 97 Register test case class.
 98 @param aClass
 99 */
100- (void)registerClass:(Class)aClass;
101
102/*!
103 Register test case class by name.
104 @param className Class name (via NSStringFromClass(aClass)
105 */
106- (void)registerClassName:(NSString *)className;
107
108/*!
109 Format test exception.
110 @param exception
111 @result Description
112 */
113+ (NSString *)descriptionForException:(NSException *)exception;
114
115/*!
116 Filename for cause of test exception.
117 @param test
118 @result Filename
119 */
120+ (NSString *)exceptionFilenameForTest:(id<GHTest>)test;
121
122/*!
123 Line number for cause of test exception.
124 @param test
125 @result Line number
126 */
127+ (NSInteger)exceptionLineNumberForTest:(id<GHTest>)test;
128
129/*!
130 Run test.
131 @param target
132 @param selector
133 @param exception Exception, if set, is retained and should be released by the caller.
134 @param interval Time to run the test
135 @param reraiseExceptions If YES, will re-raise exceptions
136 */
137+ (BOOL)runTestWithTarget:(id)target selector:(SEL)selector exception:(NSException **)exception 
138       interval:(NSTimeInterval *)interval reraiseExceptions:(BOOL)reraiseExceptions;
139
140/*!
141 Same as normal runTest without catching exceptions.
142 */
143+ (BOOL)runTestOrRaiseWithTarget:(id)target selector:(SEL)selector exception:(NSException **)exception interval:(NSTimeInterval *)interval;
144
145@end
146
147@protocol GHSenTestCase 
148- (void)raiseAfterFailure;
149@end
150
151//! @endcond