mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-25 23:06:10 +01:00
Remove Obj-C(++) support
This commit is contained in:
parent
e1e6872c4c
commit
7c97554565
@ -19,10 +19,7 @@ before moving to Catch2. You might also like to read [this blog post](https://le
|
|||||||
|
|
||||||
## What's the Catch?
|
## What's the Catch?
|
||||||
|
|
||||||
Catch2 is a multi-paradigm test framework for C++. which also supports
|
Catch2 is a multi-paradigm test framework for C++.
|
||||||
Objective-C (and maybe C).
|
|
||||||
It is primarily distributed as a single header file, although certain
|
|
||||||
extensions may require additional headers.
|
|
||||||
|
|
||||||
## How to use it
|
## How to use it
|
||||||
This documentation comprises these three parts:
|
This documentation comprises these three parts:
|
||||||
|
@ -84,8 +84,6 @@ set(INTERNAL_HEADERS
|
|||||||
${SOURCES_DIR}/matchers/catch_matchers_vector.hpp
|
${SOURCES_DIR}/matchers/catch_matchers_vector.hpp
|
||||||
${SOURCES_DIR}/catch_message.hpp
|
${SOURCES_DIR}/catch_message.hpp
|
||||||
${SOURCES_DIR}/internal/catch_meta.hpp
|
${SOURCES_DIR}/internal/catch_meta.hpp
|
||||||
${SOURCES_DIR}/catch_objc.hpp
|
|
||||||
${SOURCES_DIR}/catch_objc_arc.hpp
|
|
||||||
${SOURCES_DIR}/internal/catch_option.hpp
|
${SOURCES_DIR}/internal/catch_option.hpp
|
||||||
${SOURCES_DIR}/internal/catch_output_redirect.hpp
|
${SOURCES_DIR}/internal/catch_output_redirect.hpp
|
||||||
${SOURCES_DIR}/internal/catch_platform.hpp
|
${SOURCES_DIR}/internal/catch_platform.hpp
|
||||||
|
@ -1,212 +0,0 @@
|
|||||||
/*
|
|
||||||
* Created by Phil on 14/11/2010.
|
|
||||||
* Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
|
|
||||||
*
|
|
||||||
* Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
||||||
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
||||||
*/
|
|
||||||
#ifndef TWOBLUECUBES_CATCH_OBJC_HPP_INCLUDED
|
|
||||||
#define TWOBLUECUBES_CATCH_OBJC_HPP_INCLUDED
|
|
||||||
|
|
||||||
#include <catch2/catch_objc_arc.hpp>
|
|
||||||
|
|
||||||
#import <objc/runtime.h>
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
// NB. Any general catch headers included here must be included
|
|
||||||
// in catch.hpp first to make sure they are included by the single
|
|
||||||
// header for non obj-usage
|
|
||||||
#include <catch2/catch_test_case_info.hpp>
|
|
||||||
#include <catch2/internal/catch_string_manip.hpp>
|
|
||||||
#include <catch2/catch_tostring.hpp>
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
// This protocol is really only here for (self) documenting purposes, since
|
|
||||||
// all its methods are optional.
|
|
||||||
@protocol OcFixture
|
|
||||||
|
|
||||||
@optional
|
|
||||||
|
|
||||||
-(void) setUp;
|
|
||||||
-(void) tearDown;
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
namespace Catch {
|
|
||||||
|
|
||||||
class OcMethod : public ITestInvoker {
|
|
||||||
|
|
||||||
public:
|
|
||||||
OcMethod( Class cls, SEL sel ) : m_cls( cls ), m_sel( sel ) {}
|
|
||||||
|
|
||||||
virtual void invoke() const {
|
|
||||||
id obj = [[m_cls alloc] init];
|
|
||||||
|
|
||||||
performOptionalSelector( obj, @selector(setUp) );
|
|
||||||
performOptionalSelector( obj, m_sel );
|
|
||||||
performOptionalSelector( obj, @selector(tearDown) );
|
|
||||||
|
|
||||||
arcSafeRelease( obj );
|
|
||||||
}
|
|
||||||
private:
|
|
||||||
virtual ~OcMethod() {}
|
|
||||||
|
|
||||||
Class m_cls;
|
|
||||||
SEL m_sel;
|
|
||||||
};
|
|
||||||
|
|
||||||
namespace Detail{
|
|
||||||
|
|
||||||
|
|
||||||
inline std::string getAnnotation( Class cls,
|
|
||||||
std::string const& annotationName,
|
|
||||||
std::string const& testCaseName ) {
|
|
||||||
NSString* selStr = [[NSString alloc] initWithFormat:@"Catch_%s_%s", annotationName.c_str(), testCaseName.c_str()];
|
|
||||||
SEL sel = NSSelectorFromString( selStr );
|
|
||||||
arcSafeRelease( selStr );
|
|
||||||
id value = performOptionalSelector( cls, sel );
|
|
||||||
if( value )
|
|
||||||
return [(NSString*)value UTF8String];
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
inline std::size_t registerTestMethods() {
|
|
||||||
std::size_t noTestMethods = 0;
|
|
||||||
int noClasses = objc_getClassList( nullptr, 0 );
|
|
||||||
|
|
||||||
Class* classes = (CATCH_UNSAFE_UNRETAINED Class *)malloc( sizeof(Class) * noClasses);
|
|
||||||
objc_getClassList( classes, noClasses );
|
|
||||||
|
|
||||||
for( int c = 0; c < noClasses; c++ ) {
|
|
||||||
Class cls = classes[c];
|
|
||||||
{
|
|
||||||
u_int count;
|
|
||||||
Method* methods = class_copyMethodList( cls, &count );
|
|
||||||
for( u_int m = 0; m < count ; m++ ) {
|
|
||||||
SEL selector = method_getName(methods[m]);
|
|
||||||
std::string methodName = sel_getName(selector);
|
|
||||||
if( startsWith( methodName, "Catch_TestCase_" ) ) {
|
|
||||||
std::string testCaseName = methodName.substr( 15 );
|
|
||||||
std::string name = Detail::getAnnotation( cls, "Name", testCaseName );
|
|
||||||
std::string desc = Detail::getAnnotation( cls, "Description", testCaseName );
|
|
||||||
const char* className = class_getName( cls );
|
|
||||||
|
|
||||||
getMutableRegistryHub().registerTest( makeTestCaseInfo( new OcMethod( cls, selector ), className, NameAndTags( name.c_str(), desc.c_str() ), SourceLineInfo("",0) ) );
|
|
||||||
noTestMethods++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
free(methods);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return noTestMethods;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
namespace Matchers {
|
|
||||||
namespace Impl {
|
|
||||||
namespace NSStringMatchers {
|
|
||||||
|
|
||||||
struct StringHolder : MatcherBase<NSString*>{
|
|
||||||
StringHolder( NSString* substr ) : m_substr( [substr copy] ){}
|
|
||||||
StringHolder( StringHolder const& other ) : m_substr( [other.m_substr copy] ){}
|
|
||||||
StringHolder() {
|
|
||||||
arcSafeRelease( m_substr );
|
|
||||||
}
|
|
||||||
|
|
||||||
bool match( NSString* str ) const override {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
NSString* CATCH_ARC_STRONG m_substr;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Equals : StringHolder {
|
|
||||||
Equals( NSString* substr ) : StringHolder( substr ){}
|
|
||||||
|
|
||||||
bool match( NSString* str ) const override {
|
|
||||||
return (str != nil || m_substr == nil ) &&
|
|
||||||
[str isEqualToString:m_substr];
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string describe() const override {
|
|
||||||
return "equals string: " + Catch::Detail::stringify( m_substr );
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Contains : StringHolder {
|
|
||||||
Contains( NSString* substr ) : StringHolder( substr ){}
|
|
||||||
|
|
||||||
bool match( NSString* str ) const override {
|
|
||||||
return (str != nil || m_substr == nil ) &&
|
|
||||||
[str rangeOfString:m_substr].location != NSNotFound;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string describe() const override {
|
|
||||||
return "contains string: " + Catch::Detail::stringify( m_substr );
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct StartsWith : StringHolder {
|
|
||||||
StartsWith( NSString* substr ) : StringHolder( substr ){}
|
|
||||||
|
|
||||||
bool match( NSString* str ) const override {
|
|
||||||
return (str != nil || m_substr == nil ) &&
|
|
||||||
[str rangeOfString:m_substr].location == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string describe() const override {
|
|
||||||
return "starts with: " + Catch::Detail::stringify( m_substr );
|
|
||||||
}
|
|
||||||
};
|
|
||||||
struct EndsWith : StringHolder {
|
|
||||||
EndsWith( NSString* substr ) : StringHolder( substr ){}
|
|
||||||
|
|
||||||
bool match( NSString* str ) const override {
|
|
||||||
return (str != nil || m_substr == nil ) &&
|
|
||||||
[str rangeOfString:m_substr].location == [str length] - [m_substr length];
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string describe() const override {
|
|
||||||
return "ends with: " + Catch::Detail::stringify( m_substr );
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace NSStringMatchers
|
|
||||||
} // namespace Impl
|
|
||||||
|
|
||||||
inline Impl::NSStringMatchers::Equals
|
|
||||||
Equals( NSString* substr ){ return Impl::NSStringMatchers::Equals( substr ); }
|
|
||||||
|
|
||||||
inline Impl::NSStringMatchers::Contains
|
|
||||||
Contains( NSString* substr ){ return Impl::NSStringMatchers::Contains( substr ); }
|
|
||||||
|
|
||||||
inline Impl::NSStringMatchers::StartsWith
|
|
||||||
StartsWith( NSString* substr ){ return Impl::NSStringMatchers::StartsWith( substr ); }
|
|
||||||
|
|
||||||
inline Impl::NSStringMatchers::EndsWith
|
|
||||||
EndsWith( NSString* substr ){ return Impl::NSStringMatchers::EndsWith( substr ); }
|
|
||||||
|
|
||||||
} // namespace Matchers
|
|
||||||
|
|
||||||
using namespace Matchers;
|
|
||||||
|
|
||||||
} // namespace Catch
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
#define OC_MAKE_UNIQUE_NAME( root, uniqueSuffix ) root##uniqueSuffix
|
|
||||||
#define OC_TEST_CASE2( name, desc, uniqueSuffix ) \
|
|
||||||
+(NSString*) OC_MAKE_UNIQUE_NAME( Catch_Name_test_, uniqueSuffix ) \
|
|
||||||
{ \
|
|
||||||
return @ name; \
|
|
||||||
} \
|
|
||||||
+(NSString*) OC_MAKE_UNIQUE_NAME( Catch_Description_test_, uniqueSuffix ) \
|
|
||||||
{ \
|
|
||||||
return @ desc; \
|
|
||||||
} \
|
|
||||||
-(void) OC_MAKE_UNIQUE_NAME( Catch_TestCase_test_, uniqueSuffix )
|
|
||||||
|
|
||||||
#define OC_TEST_CASE( name, desc ) OC_TEST_CASE2( name, desc, __LINE__ )
|
|
||||||
|
|
||||||
#endif // TWOBLUECUBES_CATCH_OBJC_HPP_INCLUDED
|
|
@ -1,51 +0,0 @@
|
|||||||
/*
|
|
||||||
* Created by Phil on 1/08/2012.
|
|
||||||
* Copyright 2012 Two Blue Cubes Ltd. All rights reserved.
|
|
||||||
*
|
|
||||||
* Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
||||||
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
||||||
*/
|
|
||||||
#ifndef TWOBLUECUBES_CATCH_OBJC_ARC_HPP_INCLUDED
|
|
||||||
#define TWOBLUECUBES_CATCH_OBJC_ARC_HPP_INCLUDED
|
|
||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
|
||||||
|
|
||||||
#ifdef __has_feature
|
|
||||||
#define CATCH_ARC_ENABLED __has_feature(objc_arc)
|
|
||||||
#else
|
|
||||||
#define CATCH_ARC_ENABLED 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void arcSafeRelease( NSObject* obj );
|
|
||||||
id performOptionalSelector( id obj, SEL sel );
|
|
||||||
|
|
||||||
#if !CATCH_ARC_ENABLED
|
|
||||||
inline void arcSafeRelease( NSObject* obj ) {
|
|
||||||
[obj release];
|
|
||||||
}
|
|
||||||
inline id performOptionalSelector( id obj, SEL sel ) {
|
|
||||||
if( [obj respondsToSelector: sel] )
|
|
||||||
return [obj performSelector: sel];
|
|
||||||
return nil;
|
|
||||||
}
|
|
||||||
#define CATCH_UNSAFE_UNRETAINED
|
|
||||||
#define CATCH_ARC_STRONG
|
|
||||||
#else
|
|
||||||
inline void arcSafeRelease( NSObject* ){}
|
|
||||||
inline id performOptionalSelector( id obj, SEL sel ) {
|
|
||||||
#ifdef __clang__
|
|
||||||
#pragma clang diagnostic push
|
|
||||||
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
|
|
||||||
#endif
|
|
||||||
if( [obj respondsToSelector: sel] )
|
|
||||||
return [obj performSelector: sel];
|
|
||||||
#ifdef __clang__
|
|
||||||
#pragma clang diagnostic pop
|
|
||||||
#endif
|
|
||||||
return nil;
|
|
||||||
}
|
|
||||||
#define CATCH_UNSAFE_UNRETAINED __unsafe_unretained
|
|
||||||
#define CATCH_ARC_STRONG __strong
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // TWOBLUECUBES_CATCH_OBJC_ARC_HPP_INCLUDED
|
|
@ -21,10 +21,6 @@
|
|||||||
#include <string_view>
|
#include <string_view>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __OBJC__
|
|
||||||
#include <catch2/catch_objc_arc.hpp>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
#pragma warning(disable:4180) // We attempt to stream a function (address) by const&, which MSVC complains about but is harmless
|
#pragma warning(disable:4180) // We attempt to stream a function (address) by const&, which MSVC complains about but is harmless
|
||||||
@ -323,30 +319,6 @@ namespace Catch {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __OBJC__
|
|
||||||
template<>
|
|
||||||
struct StringMaker<NSString*> {
|
|
||||||
static std::string convert(NSString * nsstring) {
|
|
||||||
if (!nsstring)
|
|
||||||
return "nil";
|
|
||||||
return std::string("@") + [nsstring UTF8String];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
template<>
|
|
||||||
struct StringMaker<NSObject*> {
|
|
||||||
static std::string convert(NSObject* nsObject) {
|
|
||||||
return ::Catch::Detail::stringify([nsObject description]);
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
namespace Detail {
|
|
||||||
inline std::string stringify( NSString* nsstring ) {
|
|
||||||
return StringMaker<NSString*>::convert( nsstring );
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Detail
|
|
||||||
#endif // __OBJC__
|
|
||||||
|
|
||||||
} // namespace Catch
|
} // namespace Catch
|
||||||
|
|
||||||
//////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////
|
||||||
|
@ -20,8 +20,6 @@ namespace Catch {
|
|||||||
CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION
|
CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef __OBJC__
|
|
||||||
|
|
||||||
#if defined(CATCH_CONFIG_WCHAR) && defined(CATCH_PLATFORM_WINDOWS) && defined(_UNICODE) && !defined(DO_NOT_USE_WMAIN)
|
#if defined(CATCH_CONFIG_WCHAR) && defined(CATCH_PLATFORM_WINDOWS) && defined(_UNICODE) && !defined(DO_NOT_USE_WMAIN)
|
||||||
// Standard C/C++ Win32 Unicode wmain entry point
|
// Standard C/C++ Win32 Unicode wmain entry point
|
||||||
extern "C" int wmain (int argc, wchar_t * argv[], wchar_t * []) {
|
extern "C" int wmain (int argc, wchar_t * argv[], wchar_t * []) {
|
||||||
@ -37,24 +35,4 @@ int main (int argc, char * argv[]) {
|
|||||||
return Catch::Session().run( argc, argv );
|
return Catch::Session().run( argc, argv );
|
||||||
}
|
}
|
||||||
|
|
||||||
#else // __OBJC__
|
|
||||||
|
|
||||||
// Objective-C entry point
|
|
||||||
int main (int argc, char * const argv[]) {
|
|
||||||
#if !CATCH_ARC_ENABLED
|
|
||||||
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Catch::registerTestMethods();
|
|
||||||
int result = Catch::Session().run( argc, (char**)argv );
|
|
||||||
|
|
||||||
#if !CATCH_ARC_ENABLED
|
|
||||||
[pool drain];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // __OBJC__
|
|
||||||
|
|
||||||
#endif // TWOBLUECUBES_CATCH_DEFAULT_MAIN_HPP_INCLUDED
|
#endif // TWOBLUECUBES_CATCH_DEFAULT_MAIN_HPP_INCLUDED
|
||||||
|
@ -11,10 +11,6 @@
|
|||||||
#include <catch2/internal/catch_compiler_capabilities.hpp>
|
#include <catch2/internal/catch_compiler_capabilities.hpp>
|
||||||
#include <catch2/internal/catch_enforce.hpp>
|
#include <catch2/internal/catch_enforce.hpp>
|
||||||
|
|
||||||
#ifdef __OBJC__
|
|
||||||
#import "Foundation/Foundation.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
|
|
||||||
ExceptionTranslatorRegistry::~ExceptionTranslatorRegistry() {
|
ExceptionTranslatorRegistry::~ExceptionTranslatorRegistry() {
|
||||||
@ -27,15 +23,6 @@ namespace Catch {
|
|||||||
#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
|
#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
|
||||||
std::string ExceptionTranslatorRegistry::translateActiveException() const {
|
std::string ExceptionTranslatorRegistry::translateActiveException() const {
|
||||||
try {
|
try {
|
||||||
#ifdef __OBJC__
|
|
||||||
// In Objective-C try objective-c exceptions first
|
|
||||||
@try {
|
|
||||||
return tryTranslators();
|
|
||||||
}
|
|
||||||
@catch (NSException *exception) {
|
|
||||||
return Catch::Detail::stringify( [exception description] );
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
// Compiling a mixed mode project with MSVC means that CLR
|
// Compiling a mixed mode project with MSVC means that CLR
|
||||||
// exceptions will be caught in (...) as well. However, these
|
// exceptions will be caught in (...) as well. However, these
|
||||||
// do not fill-in std::current_exception and thus lead to crash
|
// do not fill-in std::current_exception and thus lead to crash
|
||||||
@ -48,7 +35,6 @@ namespace Catch {
|
|||||||
return "Non C++ exception. Possibly a CLR exception.";
|
return "Non C++ exception. Possibly a CLR exception.";
|
||||||
}
|
}
|
||||||
return tryTranslators();
|
return tryTranslators();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
catch( TestFailureException& ) {
|
catch( TestFailureException& ) {
|
||||||
std::rethrow_exception(std::current_exception());
|
std::rethrow_exception(std::current_exception());
|
||||||
|
@ -37,15 +37,6 @@ namespace Matchers {
|
|||||||
virtual bool match(ObjectT const& arg) const = 0;
|
virtual bool match(ObjectT const& arg) const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined(__OBJC__)
|
|
||||||
// Hack to fix Catch GH issue #1661. Could use id for generic Object support.
|
|
||||||
// use of const for Object pointers is very uncommon and under ARC it causes some kind of signature mismatch that breaks compilation
|
|
||||||
template<>
|
|
||||||
struct MatcherMethod<NSString*> {
|
|
||||||
virtual bool match(NSString* arg) const = 0;
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __clang__
|
#ifdef __clang__
|
||||||
# pragma clang diagnostic pop
|
# pragma clang diagnostic pop
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,294 +0,0 @@
|
|||||||
// !$*UTF8*$!
|
|
||||||
{
|
|
||||||
archiveVersion = 1;
|
|
||||||
classes = {
|
|
||||||
};
|
|
||||||
objectVersion = 46;
|
|
||||||
objects = {
|
|
||||||
|
|
||||||
/* Begin PBXBuildFile section */
|
|
||||||
4A5C29AA1F715603007CB94C /* catch_objc_impl.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4A5C29A91F715603007CB94C /* catch_objc_impl.mm */; };
|
|
||||||
4A63D2AC14E3C1A900F615CB /* OCTest.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4A63D2AB14E3C1A900F615CB /* OCTest.1 */; };
|
|
||||||
4A63D2B314E3C1E600F615CB /* Main.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4A63D2B214E3C1E600F615CB /* Main.mm */; };
|
|
||||||
4A63D2C014E4544700F615CB /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4A63D2BF14E4544700F615CB /* Foundation.framework */; };
|
|
||||||
4A63D2C614E454CC00F615CB /* CatchOCTestCase.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4A63D2C214E454CC00F615CB /* CatchOCTestCase.mm */; };
|
|
||||||
4A63D2C714E454CC00F615CB /* OCTest.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4A63D2C314E454CC00F615CB /* OCTest.mm */; };
|
|
||||||
4A63D2C814E454CC00F615CB /* TestObj.m in Sources */ = {isa = PBXBuildFile; fileRef = 4A63D2C514E454CC00F615CB /* TestObj.m */; };
|
|
||||||
/* End PBXBuildFile section */
|
|
||||||
|
|
||||||
/* Begin PBXCopyFilesBuildPhase section */
|
|
||||||
4A63D2A314E3C1A900F615CB /* CopyFiles */ = {
|
|
||||||
isa = PBXCopyFilesBuildPhase;
|
|
||||||
buildActionMask = 2147483647;
|
|
||||||
dstPath = /usr/share/man/man1/;
|
|
||||||
dstSubfolderSpec = 0;
|
|
||||||
files = (
|
|
||||||
4A63D2AC14E3C1A900F615CB /* OCTest.1 in CopyFiles */,
|
|
||||||
);
|
|
||||||
runOnlyForDeploymentPostprocessing = 1;
|
|
||||||
};
|
|
||||||
/* End PBXCopyFilesBuildPhase section */
|
|
||||||
|
|
||||||
/* Begin PBXFileReference section */
|
|
||||||
4A5C29A91F715603007CB94C /* catch_objc_impl.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = catch_objc_impl.mm; sourceTree = "<group>"; };
|
|
||||||
4A63D2A514E3C1A900F615CB /* OCTest */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = OCTest; sourceTree = BUILT_PRODUCTS_DIR; };
|
|
||||||
4A63D2AB14E3C1A900F615CB /* OCTest.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = OCTest.1; sourceTree = "<group>"; };
|
|
||||||
4A63D2B214E3C1E600F615CB /* Main.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = Main.mm; sourceTree = "<group>"; };
|
|
||||||
4A63D2BF14E4544700F615CB /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
|
|
||||||
4A63D2C114E454CC00F615CB /* CatchOCTestCase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CatchOCTestCase.h; sourceTree = "<group>"; };
|
|
||||||
4A63D2C214E454CC00F615CB /* CatchOCTestCase.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CatchOCTestCase.mm; sourceTree = "<group>"; };
|
|
||||||
4A63D2C314E454CC00F615CB /* OCTest.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = OCTest.mm; sourceTree = "<group>"; };
|
|
||||||
4A63D2C414E454CC00F615CB /* TestObj.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestObj.h; sourceTree = "<group>"; };
|
|
||||||
4A63D2C514E454CC00F615CB /* TestObj.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TestObj.m; sourceTree = "<group>"; };
|
|
||||||
/* End PBXFileReference section */
|
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
|
||||||
4A63D2A214E3C1A900F615CB /* Frameworks */ = {
|
|
||||||
isa = PBXFrameworksBuildPhase;
|
|
||||||
buildActionMask = 2147483647;
|
|
||||||
files = (
|
|
||||||
4A63D2C014E4544700F615CB /* Foundation.framework in Frameworks */,
|
|
||||||
);
|
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
|
||||||
};
|
|
||||||
/* End PBXFrameworksBuildPhase section */
|
|
||||||
|
|
||||||
/* Begin PBXGroup section */
|
|
||||||
4A63D29A14E3C1A900F615CB = {
|
|
||||||
isa = PBXGroup;
|
|
||||||
children = (
|
|
||||||
4AA0D94F154C0A63004B4193 /* Catch */,
|
|
||||||
4A63D2BF14E4544700F615CB /* Foundation.framework */,
|
|
||||||
4A63D2A814E3C1A900F615CB /* OCTest */,
|
|
||||||
4A63D2A614E3C1A900F615CB /* Products */,
|
|
||||||
);
|
|
||||||
sourceTree = "<group>";
|
|
||||||
};
|
|
||||||
4A63D2A614E3C1A900F615CB /* Products */ = {
|
|
||||||
isa = PBXGroup;
|
|
||||||
children = (
|
|
||||||
4A63D2A514E3C1A900F615CB /* OCTest */,
|
|
||||||
);
|
|
||||||
name = Products;
|
|
||||||
sourceTree = "<group>";
|
|
||||||
};
|
|
||||||
4A63D2A814E3C1A900F615CB /* OCTest */ = {
|
|
||||||
isa = PBXGroup;
|
|
||||||
children = (
|
|
||||||
4A63D2C114E454CC00F615CB /* CatchOCTestCase.h */,
|
|
||||||
4A63D2C214E454CC00F615CB /* CatchOCTestCase.mm */,
|
|
||||||
4A63D2C314E454CC00F615CB /* OCTest.mm */,
|
|
||||||
4A63D2C414E454CC00F615CB /* TestObj.h */,
|
|
||||||
4A63D2C514E454CC00F615CB /* TestObj.m */,
|
|
||||||
4A63D2B214E3C1E600F615CB /* Main.mm */,
|
|
||||||
4A63D2AB14E3C1A900F615CB /* OCTest.1 */,
|
|
||||||
);
|
|
||||||
path = OCTest;
|
|
||||||
sourceTree = "<group>";
|
|
||||||
};
|
|
||||||
4AA0D94F154C0A63004B4193 /* Catch */ = {
|
|
||||||
isa = PBXGroup;
|
|
||||||
children = (
|
|
||||||
4A5C29A91F715603007CB94C /* catch_objc_impl.mm */,
|
|
||||||
);
|
|
||||||
name = Catch;
|
|
||||||
sourceTree = "<group>";
|
|
||||||
};
|
|
||||||
/* End PBXGroup section */
|
|
||||||
|
|
||||||
/* Begin PBXNativeTarget section */
|
|
||||||
4A63D2A414E3C1A900F615CB /* OCTest */ = {
|
|
||||||
isa = PBXNativeTarget;
|
|
||||||
buildConfigurationList = 4A63D2AF14E3C1A900F615CB /* Build configuration list for PBXNativeTarget "OCTest" */;
|
|
||||||
buildPhases = (
|
|
||||||
4A63D2A114E3C1A900F615CB /* Sources */,
|
|
||||||
4A63D2A214E3C1A900F615CB /* Frameworks */,
|
|
||||||
4A63D2A314E3C1A900F615CB /* CopyFiles */,
|
|
||||||
);
|
|
||||||
buildRules = (
|
|
||||||
);
|
|
||||||
dependencies = (
|
|
||||||
);
|
|
||||||
name = OCTest;
|
|
||||||
productName = OCTest;
|
|
||||||
productReference = 4A63D2A514E3C1A900F615CB /* OCTest */;
|
|
||||||
productType = "com.apple.product-type.tool";
|
|
||||||
};
|
|
||||||
/* End PBXNativeTarget section */
|
|
||||||
|
|
||||||
/* Begin PBXProject section */
|
|
||||||
4A63D29C14E3C1A900F615CB /* Project object */ = {
|
|
||||||
isa = PBXProject;
|
|
||||||
attributes = {
|
|
||||||
LastUpgradeCheck = 0940;
|
|
||||||
};
|
|
||||||
buildConfigurationList = 4A63D29F14E3C1A900F615CB /* Build configuration list for PBXProject "OCTest" */;
|
|
||||||
compatibilityVersion = "Xcode 3.2";
|
|
||||||
developmentRegion = English;
|
|
||||||
hasScannedForEncodings = 0;
|
|
||||||
knownRegions = (
|
|
||||||
en,
|
|
||||||
);
|
|
||||||
mainGroup = 4A63D29A14E3C1A900F615CB;
|
|
||||||
productRefGroup = 4A63D2A614E3C1A900F615CB /* Products */;
|
|
||||||
projectDirPath = "";
|
|
||||||
projectRoot = "";
|
|
||||||
targets = (
|
|
||||||
4A63D2A414E3C1A900F615CB /* OCTest */,
|
|
||||||
);
|
|
||||||
};
|
|
||||||
/* End PBXProject section */
|
|
||||||
|
|
||||||
/* Begin PBXSourcesBuildPhase section */
|
|
||||||
4A63D2A114E3C1A900F615CB /* Sources */ = {
|
|
||||||
isa = PBXSourcesBuildPhase;
|
|
||||||
buildActionMask = 2147483647;
|
|
||||||
files = (
|
|
||||||
4A63D2B314E3C1E600F615CB /* Main.mm in Sources */,
|
|
||||||
4A5C29AA1F715603007CB94C /* catch_objc_impl.mm in Sources */,
|
|
||||||
4A63D2C614E454CC00F615CB /* CatchOCTestCase.mm in Sources */,
|
|
||||||
4A63D2C714E454CC00F615CB /* OCTest.mm in Sources */,
|
|
||||||
4A63D2C814E454CC00F615CB /* TestObj.m in Sources */,
|
|
||||||
);
|
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
|
||||||
};
|
|
||||||
/* End PBXSourcesBuildPhase section */
|
|
||||||
|
|
||||||
/* Begin XCBuildConfiguration section */
|
|
||||||
4A63D2AD14E3C1A900F615CB /* Debug */ = {
|
|
||||||
isa = XCBuildConfiguration;
|
|
||||||
buildSettings = {
|
|
||||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
|
||||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
|
||||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
|
||||||
CLANG_WARN_COMMA = YES;
|
|
||||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
|
||||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
|
||||||
CLANG_WARN_EMPTY_BODY = YES;
|
|
||||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
|
||||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
|
||||||
CLANG_WARN_INT_CONVERSION = YES;
|
|
||||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
|
||||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
|
||||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
|
||||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
|
||||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
|
||||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
|
||||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
|
||||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
|
||||||
COPY_PHASE_STRIP = NO;
|
|
||||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
|
||||||
ENABLE_TESTABILITY = YES;
|
|
||||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
|
||||||
GCC_DYNAMIC_NO_PIC = NO;
|
|
||||||
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
|
|
||||||
GCC_NO_COMMON_BLOCKS = YES;
|
|
||||||
GCC_OPTIMIZATION_LEVEL = 0;
|
|
||||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
|
||||||
"DEBUG=1",
|
|
||||||
"$(inherited)",
|
|
||||||
);
|
|
||||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
|
||||||
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
|
|
||||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
|
||||||
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
|
|
||||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
|
||||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
|
||||||
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
|
||||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
|
||||||
HEADER_SEARCH_PATHS = ../../../include;
|
|
||||||
MACOSX_DEPLOYMENT_TARGET = 10.7;
|
|
||||||
ONLY_ACTIVE_ARCH = YES;
|
|
||||||
SDKROOT = macosx;
|
|
||||||
};
|
|
||||||
name = Debug;
|
|
||||||
};
|
|
||||||
4A63D2AE14E3C1A900F615CB /* Release */ = {
|
|
||||||
isa = XCBuildConfiguration;
|
|
||||||
buildSettings = {
|
|
||||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
|
||||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
|
||||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
|
||||||
CLANG_WARN_COMMA = YES;
|
|
||||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
|
||||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
|
||||||
CLANG_WARN_EMPTY_BODY = YES;
|
|
||||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
|
||||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
|
||||||
CLANG_WARN_INT_CONVERSION = YES;
|
|
||||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
|
||||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
|
||||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
|
||||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
|
||||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
|
||||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
|
||||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
|
||||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
|
||||||
COPY_PHASE_STRIP = YES;
|
|
||||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
|
||||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
|
||||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
|
||||||
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
|
|
||||||
GCC_NO_COMMON_BLOCKS = YES;
|
|
||||||
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
|
|
||||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
|
||||||
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
|
|
||||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
|
||||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
|
||||||
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
|
||||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
|
||||||
HEADER_SEARCH_PATHS = ../../../include;
|
|
||||||
MACOSX_DEPLOYMENT_TARGET = 10.7;
|
|
||||||
SDKROOT = macosx;
|
|
||||||
};
|
|
||||||
name = Release;
|
|
||||||
};
|
|
||||||
4A63D2B014E3C1A900F615CB /* Debug */ = {
|
|
||||||
isa = XCBuildConfiguration;
|
|
||||||
buildSettings = {
|
|
||||||
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
|
|
||||||
CLANG_CXX_LIBRARY = "libc++";
|
|
||||||
CLANG_ENABLE_OBJC_ARC = YES;
|
|
||||||
HEADER_SEARCH_PATHS = ../../../include;
|
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
|
||||||
};
|
|
||||||
name = Debug;
|
|
||||||
};
|
|
||||||
4A63D2B114E3C1A900F615CB /* Release */ = {
|
|
||||||
isa = XCBuildConfiguration;
|
|
||||||
buildSettings = {
|
|
||||||
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
|
|
||||||
CLANG_CXX_LIBRARY = "libc++";
|
|
||||||
CLANG_ENABLE_OBJC_ARC = YES;
|
|
||||||
HEADER_SEARCH_PATHS = ../../../include;
|
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
|
||||||
};
|
|
||||||
name = Release;
|
|
||||||
};
|
|
||||||
/* End XCBuildConfiguration section */
|
|
||||||
|
|
||||||
/* Begin XCConfigurationList section */
|
|
||||||
4A63D29F14E3C1A900F615CB /* Build configuration list for PBXProject "OCTest" */ = {
|
|
||||||
isa = XCConfigurationList;
|
|
||||||
buildConfigurations = (
|
|
||||||
4A63D2AD14E3C1A900F615CB /* Debug */,
|
|
||||||
4A63D2AE14E3C1A900F615CB /* Release */,
|
|
||||||
);
|
|
||||||
defaultConfigurationIsVisible = 0;
|
|
||||||
defaultConfigurationName = Release;
|
|
||||||
};
|
|
||||||
4A63D2AF14E3C1A900F615CB /* Build configuration list for PBXNativeTarget "OCTest" */ = {
|
|
||||||
isa = XCConfigurationList;
|
|
||||||
buildConfigurations = (
|
|
||||||
4A63D2B014E3C1A900F615CB /* Debug */,
|
|
||||||
4A63D2B114E3C1A900F615CB /* Release */,
|
|
||||||
);
|
|
||||||
defaultConfigurationIsVisible = 0;
|
|
||||||
defaultConfigurationName = Release;
|
|
||||||
};
|
|
||||||
/* End XCConfigurationList section */
|
|
||||||
};
|
|
||||||
rootObject = 4A63D29C14E3C1A900F615CB /* Project object */;
|
|
||||||
}
|
|
@ -1,7 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<Workspace
|
|
||||||
version = "1.0">
|
|
||||||
<FileRef
|
|
||||||
location = "self:OCTest.xcodeproj">
|
|
||||||
</FileRef>
|
|
||||||
</Workspace>
|
|
@ -1,8 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
||||||
<plist version="1.0">
|
|
||||||
<dict>
|
|
||||||
<key>IDEDidComputeMac32BitWarning</key>
|
|
||||||
<true/>
|
|
||||||
</dict>
|
|
||||||
</plist>
|
|
@ -1,25 +0,0 @@
|
|||||||
//
|
|
||||||
// CatchOCTestCase.h
|
|
||||||
// OCTest
|
|
||||||
//
|
|
||||||
// Created by Phil on 13/11/2010.
|
|
||||||
// Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
|
|
||||||
//
|
|
||||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
||||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
||||||
#ifndef TWOBLUECUBES_CATCHOCTESTCASE_H_INCLUDED
|
|
||||||
#define TWOBLUECUBES_CATCHOCTESTCASE_H_INCLUDED
|
|
||||||
|
|
||||||
#include "catch.hpp"
|
|
||||||
|
|
||||||
#import <Cocoa/Cocoa.h>
|
|
||||||
#import "TestObj.h"
|
|
||||||
|
|
||||||
@interface TestFixture : NSObject <OcFixture>
|
|
||||||
{
|
|
||||||
TestObj* obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
#endif // TWOBLUECUBES_CATCHOCTESTCASE_H_INCLUDED
|
|
@ -1,87 +0,0 @@
|
|||||||
//
|
|
||||||
// CatchOCTestCase.mm
|
|
||||||
// OCTest
|
|
||||||
//
|
|
||||||
// Created by Phil Nash on 13/11/2010.
|
|
||||||
// Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
|
|
||||||
//
|
|
||||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
||||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
||||||
|
|
||||||
#import "CatchOCTestCase.h"
|
|
||||||
|
|
||||||
|
|
||||||
@implementation TestFixture
|
|
||||||
|
|
||||||
|
|
||||||
-(void) setUp
|
|
||||||
{
|
|
||||||
obj = [[TestObj alloc] init];
|
|
||||||
}
|
|
||||||
|
|
||||||
-(void) tearDown
|
|
||||||
{
|
|
||||||
arcSafeRelease( obj );
|
|
||||||
}
|
|
||||||
|
|
||||||
OC_TEST_CASE( "This is a test case", "" )
|
|
||||||
{
|
|
||||||
REQUIRE( obj.int_val == 0 );
|
|
||||||
|
|
||||||
obj.int_val = 1;
|
|
||||||
|
|
||||||
REQUIRE( obj.int_val == 1 );
|
|
||||||
}
|
|
||||||
|
|
||||||
OC_TEST_CASE( "This is another test case", "" )
|
|
||||||
{
|
|
||||||
REQUIRE( obj.int_val == 0 );
|
|
||||||
|
|
||||||
obj.int_val = 2;
|
|
||||||
|
|
||||||
REQUIRE( obj.int_val == 2 );
|
|
||||||
}
|
|
||||||
|
|
||||||
OC_TEST_CASE( "tests a boolean value", "[!shouldfail]" )
|
|
||||||
{
|
|
||||||
CHECK( [obj isTrue] == NO );
|
|
||||||
CHECK( [obj isFalse] == YES );
|
|
||||||
}
|
|
||||||
|
|
||||||
OC_TEST_CASE( "throws an Objective-C exception", "[!throws][!shouldfail]" )
|
|
||||||
{
|
|
||||||
@throw [[NSException alloc] initWithName: NSGenericException
|
|
||||||
reason: @"Objective-C exception"
|
|
||||||
userInfo: nil];
|
|
||||||
}
|
|
||||||
OC_TEST_CASE( "throws a std c++ exception", "[!throws][!shouldfail]" )
|
|
||||||
{
|
|
||||||
throw std::domain_error( "std C++ exception" );
|
|
||||||
}
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
template<typename T>
|
|
||||||
void useObject( const T& object ){}
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
void useObject( const T* object ){}
|
|
||||||
|
|
||||||
OC_TEST_CASE( "Matches work with OC types (NSString so far)", "[!shouldfail]" )
|
|
||||||
{
|
|
||||||
using namespace Catch::Matchers;
|
|
||||||
|
|
||||||
REQUIRE_THAT( @"This is a string", Equals( @"This isn't a string" ) );
|
|
||||||
REQUIRE_THAT( @"This is a string", Contains( @"is a" ) );
|
|
||||||
REQUIRE_THAT( @"This is a string", StartsWith( @"This" ) );
|
|
||||||
REQUIRE_THAT( @"This is a string", EndsWith( @"string" ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
OC_TEST_CASE( "nil NSString should not crash the test", "[!shouldfail]" )
|
|
||||||
{
|
|
||||||
using namespace Catch::Matchers;
|
|
||||||
|
|
||||||
CHECK_THAT( (NSString*)nil, Equals( @"This should fail, but not crash" ) );
|
|
||||||
CHECK_THAT( (NSString*)nil, StartsWith( @"anything" ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
@ -1,2 +0,0 @@
|
|||||||
#define CATCH_CONFIG_MAIN
|
|
||||||
#import "catch.hpp"
|
|
@ -1,79 +0,0 @@
|
|||||||
.\"Modified from man(1) of FreeBSD, the NetBSD mdoc.template, and mdoc.samples.
|
|
||||||
.\"See Also:
|
|
||||||
.\"man mdoc.samples for a complete listing of options
|
|
||||||
.\"man mdoc for the short list of editing options
|
|
||||||
.\"/usr/share/misc/mdoc.template
|
|
||||||
.Dd 09/02/2012 \" DATE
|
|
||||||
.Dt OCTest 1 \" Program name and manual section number
|
|
||||||
.Os Darwin
|
|
||||||
.Sh NAME \" Section Header - required - don't modify
|
|
||||||
.Nm OCTest,
|
|
||||||
.\" The following lines are read in generating the apropos(man -k) database. Use only key
|
|
||||||
.\" words here as the database is built based on the words here and in the .ND line.
|
|
||||||
.Nm Other_name_for_same_program(),
|
|
||||||
.Nm Yet another name for the same program.
|
|
||||||
.\" Use .Nm macro to designate other names for the documented program.
|
|
||||||
.Nd This line parsed for whatis database.
|
|
||||||
.Sh SYNOPSIS \" Section Header - required - don't modify
|
|
||||||
.Nm
|
|
||||||
.Op Fl abcd \" [-abcd]
|
|
||||||
.Op Fl a Ar path \" [-a path]
|
|
||||||
.Op Ar file \" [file]
|
|
||||||
.Op Ar \" [file ...]
|
|
||||||
.Ar arg0 \" Underlined argument - use .Ar anywhere to underline
|
|
||||||
arg2 ... \" Arguments
|
|
||||||
.Sh DESCRIPTION \" Section Header - required - don't modify
|
|
||||||
Use the .Nm macro to refer to your program throughout the man page like such:
|
|
||||||
.Nm
|
|
||||||
Underlining is accomplished with the .Ar macro like this:
|
|
||||||
.Ar underlined text .
|
|
||||||
.Pp \" Inserts a space
|
|
||||||
A list of items with descriptions:
|
|
||||||
.Bl -tag -width -indent \" Begins a tagged list
|
|
||||||
.It item a \" Each item preceded by .It macro
|
|
||||||
Description of item a
|
|
||||||
.It item b
|
|
||||||
Description of item b
|
|
||||||
.El \" Ends the list
|
|
||||||
.Pp
|
|
||||||
A list of flags and their descriptions:
|
|
||||||
.Bl -tag -width -indent \" Differs from above in tag removed
|
|
||||||
.It Fl a \"-a flag as a list item
|
|
||||||
Description of -a flag
|
|
||||||
.It Fl b
|
|
||||||
Description of -b flag
|
|
||||||
.El \" Ends the list
|
|
||||||
.Pp
|
|
||||||
.\" .Sh ENVIRONMENT \" May not be needed
|
|
||||||
.\" .Bl -tag -width "ENV_VAR_1" -indent \" ENV_VAR_1 is width of the string ENV_VAR_1
|
|
||||||
.\" .It Ev ENV_VAR_1
|
|
||||||
.\" Description of ENV_VAR_1
|
|
||||||
.\" .It Ev ENV_VAR_2
|
|
||||||
.\" Description of ENV_VAR_2
|
|
||||||
.\" .El
|
|
||||||
.Sh FILES \" File used or created by the topic of the man page
|
|
||||||
.Bl -tag -width "/Users/joeuser/Library/really_long_file_name" -compact
|
|
||||||
.It Pa /usr/share/file_name
|
|
||||||
FILE_1 description
|
|
||||||
.It Pa /Users/joeuser/Library/really_long_file_name
|
|
||||||
FILE_2 description
|
|
||||||
.El \" Ends the list
|
|
||||||
.\" .Sh DIAGNOSTICS \" May not be needed
|
|
||||||
.\" .Bl -diag
|
|
||||||
.\" .It Diagnostic Tag
|
|
||||||
.\" Diagnostic information here.
|
|
||||||
.\" .It Diagnostic Tag
|
|
||||||
.\" Diagnostic information here.
|
|
||||||
.\" .El
|
|
||||||
.Sh SEE ALSO
|
|
||||||
.\" List links in ascending order by section, alphabetically within a section.
|
|
||||||
.\" Please do not reference files that do not exist without filing a bug report
|
|
||||||
.Xr a 1 ,
|
|
||||||
.Xr b 1 ,
|
|
||||||
.Xr c 1 ,
|
|
||||||
.Xr a 2 ,
|
|
||||||
.Xr b 2 ,
|
|
||||||
.Xr a 3 ,
|
|
||||||
.Xr b 3
|
|
||||||
.\" .Sh BUGS \" Document known, unremedied bugs
|
|
||||||
.\" .Sh HISTORY \" Document history if command behaves in a unique manner
|
|
@ -1,28 +0,0 @@
|
|||||||
/*
|
|
||||||
* OCTest.mm
|
|
||||||
* OCTest
|
|
||||||
*
|
|
||||||
* Created by Phil on 13/11/2010.
|
|
||||||
* Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
|
|
||||||
*
|
|
||||||
* Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
||||||
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#import "catch.hpp"
|
|
||||||
|
|
||||||
#import "TestObj.h"
|
|
||||||
|
|
||||||
TEST_CASE( "OCTest/TestObj", "tests TestObj" )
|
|
||||||
{
|
|
||||||
TestObj* obj = [[TestObj alloc] init];
|
|
||||||
|
|
||||||
REQUIRE( obj.int_val == 0 );
|
|
||||||
|
|
||||||
obj.int_val = 1;
|
|
||||||
|
|
||||||
REQUIRE( obj.int_val == 1 );
|
|
||||||
|
|
||||||
arcSafeRelease( obj );
|
|
||||||
}
|
|
@ -1,28 +0,0 @@
|
|||||||
//
|
|
||||||
// TestObj.h
|
|
||||||
// OCTest
|
|
||||||
//
|
|
||||||
// Created by Phil on 13/11/2010.
|
|
||||||
// Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
|
|
||||||
//
|
|
||||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
||||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
||||||
#ifndef TWOBLUECUBES_TESTOBJ_H_INCLUDED
|
|
||||||
#define TWOBLUECUBES_TESTOBJ_H_INCLUDED
|
|
||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
|
||||||
|
|
||||||
|
|
||||||
@interface TestObj : NSObject {
|
|
||||||
|
|
||||||
int int_val;
|
|
||||||
}
|
|
||||||
|
|
||||||
-(BOOL) isTrue;
|
|
||||||
-(BOOL) isFalse;
|
|
||||||
|
|
||||||
@property (nonatomic, assign ) int int_val;
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
#endif // TWOBLUECUBES_TESTOBJ_H_INCLUDED
|
|
@ -1,25 +0,0 @@
|
|||||||
//
|
|
||||||
// TestObj.m
|
|
||||||
// OCTest
|
|
||||||
//
|
|
||||||
// Created by Phil on 13/11/2010.
|
|
||||||
// Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
|
|
||||||
//
|
|
||||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
||||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
||||||
|
|
||||||
#import "TestObj.h"
|
|
||||||
|
|
||||||
|
|
||||||
@implementation TestObj
|
|
||||||
|
|
||||||
@synthesize int_val;
|
|
||||||
|
|
||||||
-(BOOL) isTrue {
|
|
||||||
return YES;
|
|
||||||
}
|
|
||||||
-(BOOL) isFalse {
|
|
||||||
return NO;
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
@ -1,69 +0,0 @@
|
|||||||
// This file #includes all the .cpp files into a single .mm
|
|
||||||
// - so they get compiled as ObjectiveC++
|
|
||||||
|
|
||||||
#include "../../../include/internal/catch_tostring.cpp"
|
|
||||||
#include "../../../include/internal/catch_approx.cpp"
|
|
||||||
#include "../../../include/internal/catch_assertionhandler.cpp"
|
|
||||||
#include "../../../include/internal/catch_assertionresult.cpp"
|
|
||||||
#include "../../../include/internal/catch_benchmark.cpp"
|
|
||||||
#include "../../../include/internal/catch_capture_matchers.cpp"
|
|
||||||
#include "../../../include/internal/catch_commandline.cpp"
|
|
||||||
#include "../../../include/internal/catch_common.cpp"
|
|
||||||
#include "../../../include/internal/catch_config.cpp"
|
|
||||||
#include "../../../include/internal/catch_console_colour.cpp"
|
|
||||||
#include "../../../include/internal/catch_context.cpp"
|
|
||||||
#include "../../../include/internal/catch_debug_console.cpp"
|
|
||||||
#include "../../../include/internal/catch_debugger.cpp"
|
|
||||||
#include "../../../include/internal/catch_decomposer.cpp"
|
|
||||||
#include "../../../include/internal/catch_errno_guard.cpp"
|
|
||||||
#include "../../../include/internal/catch_exception_translator_registry.cpp"
|
|
||||||
#include "../../../include/internal/catch_fatal_condition.cpp"
|
|
||||||
#include "../../../include/internal/catch_interfaces_capture.cpp"
|
|
||||||
#include "../../../include/internal/catch_interfaces_config.cpp"
|
|
||||||
#include "../../../include/internal/catch_interfaces_exception.cpp"
|
|
||||||
#include "../../../include/internal/catch_interfaces_registry_hub.cpp"
|
|
||||||
#include "../../../include/internal/catch_interfaces_reporter.cpp"
|
|
||||||
#include "../../../include/internal/catch_interfaces_runner.cpp"
|
|
||||||
#include "../../../include/internal/catch_interfaces_testcase.cpp"
|
|
||||||
#include "../../../include/internal/catch_leak_detector.cpp"
|
|
||||||
#include "../../../include/internal/catch_list.cpp"
|
|
||||||
#include "../../../include/internal/catch_matchers.cpp"
|
|
||||||
#include "../../../include/internal/catch_matchers_string.cpp"
|
|
||||||
#include "../../../include/internal/catch_message.cpp"
|
|
||||||
#include "../../../include/internal/catch_output_redirect.cpp"
|
|
||||||
#include "../../../include/internal/catch_random_number_generator.cpp"
|
|
||||||
#include "../../../include/internal/catch_registry_hub.cpp"
|
|
||||||
#include "../../../include/internal/catch_reporter_registry.cpp"
|
|
||||||
#include "../../../include/internal/catch_result_type.cpp"
|
|
||||||
#include "../../../include/internal/catch_run_context.cpp"
|
|
||||||
#include "../../../include/internal/catch_section.cpp"
|
|
||||||
#include "../../../include/internal/catch_section_info.cpp"
|
|
||||||
#include "../../../include/internal/catch_session.cpp"
|
|
||||||
#include "../../../include/internal/catch_startup_exception_registry.cpp"
|
|
||||||
#include "../../../include/internal/catch_stream.cpp"
|
|
||||||
#include "../../../include/internal/catch_string_manip.cpp"
|
|
||||||
#include "../../../include/internal/catch_stringref.cpp"
|
|
||||||
#include "../../../include/internal/catch_tag_alias.cpp"
|
|
||||||
#include "../../../include/internal/catch_tag_alias_autoregistrar.cpp"
|
|
||||||
#include "../../../include/internal/catch_tag_alias_registry.cpp"
|
|
||||||
#include "../../../include/internal/catch_test_case_info.cpp"
|
|
||||||
#include "../../../include/internal/catch_test_case_registry_impl.cpp"
|
|
||||||
#include "../../../include/internal/catch_test_case_tracker.cpp"
|
|
||||||
#include "../../../include/internal/catch_test_registry.cpp"
|
|
||||||
#include "../../../include/internal/catch_test_spec.cpp"
|
|
||||||
#include "../../../include/internal/catch_test_spec_parser.cpp"
|
|
||||||
#include "../../../include/internal/catch_timer.cpp"
|
|
||||||
#include "../../../include/internal/catch_totals.cpp"
|
|
||||||
#include "../../../include/internal/catch_uncaught_exceptions.cpp"
|
|
||||||
#include "../../../include/internal/catch_version.cpp"
|
|
||||||
#include "../../../include/internal/catch_wildcard_pattern.cpp"
|
|
||||||
#include "../../../include/internal/catch_xmlwriter.cpp"
|
|
||||||
|
|
||||||
|
|
||||||
// Reporters
|
|
||||||
#include "../../../include/reporters/catch_reporter_bases.cpp"
|
|
||||||
#include "../../../include/reporters/catch_reporter_compact.cpp"
|
|
||||||
#include "../../../include/reporters/catch_reporter_console.cpp"
|
|
||||||
#include "../../../include/reporters/catch_reporter_junit.cpp"
|
|
||||||
#include "../../../include/reporters/catch_reporter_listening.cpp"
|
|
||||||
#include "../../../include/reporters/catch_reporter_xml.cpp"
|
|
Loading…
Reference in New Issue
Block a user