From 6295115d4e13c314848828d345f96167058bfc21 Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Tue, 26 May 2015 14:32:12 -0700 Subject: [PATCH 1/5] Minimal "test library" project --- src/objective-c/tests/AllTests.m | 65 +++ src/objective-c/tests/Info.plist | 24 ++ src/objective-c/tests/RxLibraryUnitTests.m | 65 +++ src/objective-c/tests/Tests.m | 40 ++ .../tests/Tests.xcodeproj/project.pbxproj | 373 ++++++++++++++++++ .../contents.xcworkspacedata | 7 + 6 files changed, 574 insertions(+) create mode 100644 src/objective-c/tests/AllTests.m create mode 100644 src/objective-c/tests/Info.plist create mode 100644 src/objective-c/tests/RxLibraryUnitTests.m create mode 100644 src/objective-c/tests/Tests.m create mode 100644 src/objective-c/tests/Tests.xcodeproj/project.pbxproj create mode 100644 src/objective-c/tests/Tests.xcodeproj/project.xcworkspace/contents.xcworkspacedata diff --git a/src/objective-c/tests/AllTests.m b/src/objective-c/tests/AllTests.m new file mode 100644 index 00000000000..d5b452a0b46 --- /dev/null +++ b/src/objective-c/tests/AllTests.m @@ -0,0 +1,65 @@ +/* + * + * Copyright 2015, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#import +#import + +@interface AllTests : XCTestCase + +@end + +@implementation AllTests + +- (void)setUp { + [super setUp]; + // Put setup code here. This method is called before the invocation of each test method in the class. +} + +- (void)tearDown { + // Put teardown code here. This method is called after the invocation of each test method in the class. + [super tearDown]; +} + +- (void)testExample { + // This is an example of a functional test case. + XCTAssert(YES, @"Pass"); +} + +- (void)testPerformanceExample { + // This is an example of a performance test case. + [self measureBlock:^{ + // Put the code you want to measure the time of here. + }]; +} + +@end diff --git a/src/objective-c/tests/Info.plist b/src/objective-c/tests/Info.plist new file mode 100644 index 00000000000..fbeeb96ba6c --- /dev/null +++ b/src/objective-c/tests/Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + gRPC.$(PRODUCT_NAME:rfc1034identifier) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + + diff --git a/src/objective-c/tests/RxLibraryUnitTests.m b/src/objective-c/tests/RxLibraryUnitTests.m new file mode 100644 index 00000000000..d249a73b997 --- /dev/null +++ b/src/objective-c/tests/RxLibraryUnitTests.m @@ -0,0 +1,65 @@ +/* + * + * Copyright 2015, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#import +#import + +@interface RxLibraryUnitTests : XCTestCase + +@end + +@implementation RxLibraryUnitTests + +- (void)setUp { + [super setUp]; + // Put setup code here. This method is called before the invocation of each test method in the class. +} + +- (void)tearDown { + // Put teardown code here. This method is called after the invocation of each test method in the class. + [super tearDown]; +} + +- (void)testExample { + // This is an example of a functional test case. + XCTAssert(YES, @"Pass"); +} + +- (void)testPerformanceExample { + // This is an example of a performance test case. + [self measureBlock:^{ + // Put the code you want to measure the time of here. + }]; +} + +@end diff --git a/src/objective-c/tests/Tests.m b/src/objective-c/tests/Tests.m new file mode 100644 index 00000000000..b821d387206 --- /dev/null +++ b/src/objective-c/tests/Tests.m @@ -0,0 +1,40 @@ +/* + * + * Copyright 2015, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#import + +@interface Tests : NSObject +@end + +@implementation Tests +@end diff --git a/src/objective-c/tests/Tests.xcodeproj/project.pbxproj b/src/objective-c/tests/Tests.xcodeproj/project.pbxproj new file mode 100644 index 00000000000..4aa24da9239 --- /dev/null +++ b/src/objective-c/tests/Tests.xcodeproj/project.pbxproj @@ -0,0 +1,373 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 63423F491B150A5F006CF63C /* AllTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 63423F481B150A5F006CF63C /* AllTests.m */; }; + 63423F4A1B150A5F006CF63C /* libTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 635697C71B14FC11007A7283 /* libTests.a */; }; + 63423F511B151B77006CF63C /* RxLibraryUnitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 63423F501B151B77006CF63C /* RxLibraryUnitTests.m */; }; + 635697CD1B14FC11007A7283 /* Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = 635697CC1B14FC11007A7283 /* Tests.m */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 63423F4B1B150A5F006CF63C /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 635697BF1B14FC11007A7283 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 635697C61B14FC11007A7283; + remoteInfo = Tests; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 635697C51B14FC11007A7283 /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = "include/$(PRODUCT_NAME)"; + dstSubfolderSpec = 16; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 63423F441B150A5F006CF63C /* AllTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AllTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 63423F481B150A5F006CF63C /* AllTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AllTests.m; sourceTree = ""; }; + 63423F501B151B77006CF63C /* RxLibraryUnitTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RxLibraryUnitTests.m; sourceTree = ""; }; + 635697C71B14FC11007A7283 /* libTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libTests.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 635697CC1B14FC11007A7283 /* Tests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Tests.m; sourceTree = ""; }; + 635697D81B14FC11007A7283 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 63423F411B150A5F006CF63C /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 63423F4A1B150A5F006CF63C /* libTests.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 635697C41B14FC11007A7283 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 635697BE1B14FC11007A7283 = { + isa = PBXGroup; + children = ( + 635697C91B14FC11007A7283 /* Tests */, + 635697C81B14FC11007A7283 /* Products */, + ); + sourceTree = ""; + }; + 635697C81B14FC11007A7283 /* Products */ = { + isa = PBXGroup; + children = ( + 635697C71B14FC11007A7283 /* libTests.a */, + 63423F441B150A5F006CF63C /* AllTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 635697C91B14FC11007A7283 /* Tests */ = { + isa = PBXGroup; + children = ( + 63423F501B151B77006CF63C /* RxLibraryUnitTests.m */, + 63423F481B150A5F006CF63C /* AllTests.m */, + 635697CC1B14FC11007A7283 /* Tests.m */, + 635697D71B14FC11007A7283 /* Supporting Files */, + ); + name = Tests; + sourceTree = SOURCE_ROOT; + }; + 635697D71B14FC11007A7283 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 635697D81B14FC11007A7283 /* Info.plist */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 63423F431B150A5F006CF63C /* AllTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 63423F4D1B150A5F006CF63C /* Build configuration list for PBXNativeTarget "AllTests" */; + buildPhases = ( + 63423F401B150A5F006CF63C /* Sources */, + 63423F411B150A5F006CF63C /* Frameworks */, + 63423F421B150A5F006CF63C /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 63423F4C1B150A5F006CF63C /* PBXTargetDependency */, + ); + name = AllTests; + productName = AllTests; + productReference = 63423F441B150A5F006CF63C /* AllTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 635697C61B14FC11007A7283 /* Tests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 635697DB1B14FC11007A7283 /* Build configuration list for PBXNativeTarget "Tests" */; + buildPhases = ( + 635697C31B14FC11007A7283 /* Sources */, + 635697C41B14FC11007A7283 /* Frameworks */, + 635697C51B14FC11007A7283 /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Tests; + productName = Tests; + productReference = 635697C71B14FC11007A7283 /* libTests.a */; + productType = "com.apple.product-type.library.static"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 635697BF1B14FC11007A7283 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0630; + ORGANIZATIONNAME = gRPC; + TargetAttributes = { + 63423F431B150A5F006CF63C = { + CreatedOnToolsVersion = 6.3.1; + }; + 635697C61B14FC11007A7283 = { + CreatedOnToolsVersion = 6.3.1; + }; + }; + }; + buildConfigurationList = 635697C21B14FC11007A7283 /* Build configuration list for PBXProject "Tests" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = 635697BE1B14FC11007A7283; + productRefGroup = 635697C81B14FC11007A7283 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 635697C61B14FC11007A7283 /* Tests */, + 63423F431B150A5F006CF63C /* AllTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 63423F421B150A5F006CF63C /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 63423F401B150A5F006CF63C /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 63423F491B150A5F006CF63C /* AllTests.m in Sources */, + 63423F511B151B77006CF63C /* RxLibraryUnitTests.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 635697C31B14FC11007A7283 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 635697CD1B14FC11007A7283 /* Tests.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 63423F4C1B150A5F006CF63C /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 635697C61B14FC11007A7283 /* Tests */; + targetProxy = 63423F4B1B150A5F006CF63C /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + 63423F4E1B150A5F006CF63C /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + FRAMEWORK_SEARCH_PATHS = ( + "$(SDKROOT)/Developer/Library/Frameworks", + "$(inherited)", + ); + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + INFOPLIST_FILE = Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 63423F4F1B150A5F006CF63C /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + FRAMEWORK_SEARCH_PATHS = ( + "$(SDKROOT)/Developer/Library/Frameworks", + "$(inherited)", + ); + INFOPLIST_FILE = Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + 635697D91B14FC11007A7283 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.3; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + }; + name = Debug; + }; + 635697DA1B14FC11007A7283 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.3; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 635697DC1B14FC11007A7283 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + }; + name = Debug; + }; + 635697DD1B14FC11007A7283 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 63423F4D1B150A5F006CF63C /* Build configuration list for PBXNativeTarget "AllTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 63423F4E1B150A5F006CF63C /* Debug */, + 63423F4F1B150A5F006CF63C /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 635697C21B14FC11007A7283 /* Build configuration list for PBXProject "Tests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 635697D91B14FC11007A7283 /* Debug */, + 635697DA1B14FC11007A7283 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 635697DB1B14FC11007A7283 /* Build configuration list for PBXNativeTarget "Tests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 635697DC1B14FC11007A7283 /* Debug */, + 635697DD1B14FC11007A7283 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 635697BF1B14FC11007A7283 /* Project object */; +} diff --git a/src/objective-c/tests/Tests.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/src/objective-c/tests/Tests.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000000..6c0ea849302 --- /dev/null +++ b/src/objective-c/tests/Tests.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + From f3530acfceccea22c95cd3ce094e82e198b76249 Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Tue, 26 May 2015 14:34:46 -0700 Subject: [PATCH 2/5] Podfile to link RxLibrary to its unit tests --- src/objective-c/tests/Podfile | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/objective-c/tests/Podfile diff --git a/src/objective-c/tests/Podfile b/src/objective-c/tests/Podfile new file mode 100644 index 00000000000..6df063a3801 --- /dev/null +++ b/src/objective-c/tests/Podfile @@ -0,0 +1,12 @@ +source 'https://github.com/CocoaPods/Specs.git' +platform :ios, '8.0' + +pod 'gRPC/RxLibrary', :path => "../../.." + +link_with 'AllTests' + +target 'Tests' do +end + +target 'AllTests' do +end From ad0965edbe15dda5909c0fd675557cf57fef59e2 Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Wed, 27 May 2015 13:01:21 -0700 Subject: [PATCH 3/5] Install GRX into RxLibraryUnitTests.m --- src/objective-c/tests/RxLibraryUnitTests.m | 3 + .../tests/Tests.xcodeproj/project.pbxproj | 61 +++++++++++++++++++ 2 files changed, 64 insertions(+) diff --git a/src/objective-c/tests/RxLibraryUnitTests.m b/src/objective-c/tests/RxLibraryUnitTests.m index d249a73b997..8673d5286e5 100644 --- a/src/objective-c/tests/RxLibraryUnitTests.m +++ b/src/objective-c/tests/RxLibraryUnitTests.m @@ -34,6 +34,9 @@ #import #import +#import +#import + @interface RxLibraryUnitTests : XCTestCase @end diff --git a/src/objective-c/tests/Tests.xcodeproj/project.pbxproj b/src/objective-c/tests/Tests.xcodeproj/project.pbxproj index 4aa24da9239..aae34e389da 100644 --- a/src/objective-c/tests/Tests.xcodeproj/project.pbxproj +++ b/src/objective-c/tests/Tests.xcodeproj/project.pbxproj @@ -11,6 +11,7 @@ 63423F4A1B150A5F006CF63C /* libTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 635697C71B14FC11007A7283 /* libTests.a */; }; 63423F511B151B77006CF63C /* RxLibraryUnitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 63423F501B151B77006CF63C /* RxLibraryUnitTests.m */; }; 635697CD1B14FC11007A7283 /* Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = 635697CC1B14FC11007A7283 /* Tests.m */; }; + 7D8A186224D39101F90230F6 /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 35F2B6BF3BAE8F0DC4AFD76E /* libPods.a */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -36,12 +37,15 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 0A4F89D9C90E9C30990218F0 /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = ""; }; + 35F2B6BF3BAE8F0DC4AFD76E /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; }; 63423F441B150A5F006CF63C /* AllTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AllTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 63423F481B150A5F006CF63C /* AllTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AllTests.m; sourceTree = ""; }; 63423F501B151B77006CF63C /* RxLibraryUnitTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RxLibraryUnitTests.m; sourceTree = ""; }; 635697C71B14FC11007A7283 /* libTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libTests.a; sourceTree = BUILT_PRODUCTS_DIR; }; 635697CC1B14FC11007A7283 /* Tests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Tests.m; sourceTree = ""; }; 635697D81B14FC11007A7283 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + FF7B5489BCFE40111D768DD0 /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -50,6 +54,7 @@ buildActionMask = 2147483647; files = ( 63423F4A1B150A5F006CF63C /* libTests.a in Frameworks */, + 7D8A186224D39101F90230F6 /* libPods.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -63,11 +68,30 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 136D535E19727099B941D7B1 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 35F2B6BF3BAE8F0DC4AFD76E /* libPods.a */, + ); + name = Frameworks; + sourceTree = ""; + }; + 51E4650F34F854F41FF053B3 /* Pods */ = { + isa = PBXGroup; + children = ( + FF7B5489BCFE40111D768DD0 /* Pods.debug.xcconfig */, + 0A4F89D9C90E9C30990218F0 /* Pods.release.xcconfig */, + ); + name = Pods; + sourceTree = ""; + }; 635697BE1B14FC11007A7283 = { isa = PBXGroup; children = ( 635697C91B14FC11007A7283 /* Tests */, 635697C81B14FC11007A7283 /* Products */, + 51E4650F34F854F41FF053B3 /* Pods */, + 136D535E19727099B941D7B1 /* Frameworks */, ); sourceTree = ""; }; @@ -106,9 +130,11 @@ isa = PBXNativeTarget; buildConfigurationList = 63423F4D1B150A5F006CF63C /* Build configuration list for PBXNativeTarget "AllTests" */; buildPhases = ( + 914ADDD7106BA9BB8A7E569F /* Check Pods Manifest.lock */, 63423F401B150A5F006CF63C /* Sources */, 63423F411B150A5F006CF63C /* Frameworks */, 63423F421B150A5F006CF63C /* Resources */, + A441F71824DCB9D0CA297748 /* Copy Pods Resources */, ); buildRules = ( ); @@ -182,6 +208,39 @@ }; /* End PBXResourcesBuildPhase section */ +/* Begin PBXShellScriptBuildPhase section */ + 914ADDD7106BA9BB8A7E569F /* Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Check Pods Manifest.lock"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; + showEnvVarsInLog = 0; + }; + A441F71824DCB9D0CA297748 /* Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Copy Pods Resources"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods/Pods-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + /* Begin PBXSourcesBuildPhase section */ 63423F401B150A5F006CF63C /* Sources */ = { isa = PBXSourcesBuildPhase; @@ -213,6 +272,7 @@ /* Begin XCBuildConfiguration section */ 63423F4E1B150A5F006CF63C /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = FF7B5489BCFE40111D768DD0 /* Pods.debug.xcconfig */; buildSettings = { FRAMEWORK_SEARCH_PATHS = ( "$(SDKROOT)/Developer/Library/Frameworks", @@ -230,6 +290,7 @@ }; 63423F4F1B150A5F006CF63C /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 0A4F89D9C90E9C30990218F0 /* Pods.release.xcconfig */; buildSettings = { FRAMEWORK_SEARCH_PATHS = ( "$(SDKROOT)/Developer/Library/Frameworks", From 6caf9113927b4790e4207ee78cfd6799f03e6b19 Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Thu, 28 May 2015 22:40:24 -0700 Subject: [PATCH 4/5] Add a few unit tests for GRX --- src/objective-c/tests/RxLibraryUnitTests.m | 102 ++++++++++++++++++--- 1 file changed, 87 insertions(+), 15 deletions(-) diff --git a/src/objective-c/tests/RxLibraryUnitTests.m b/src/objective-c/tests/RxLibraryUnitTests.m index 8673d5286e5..89984d9481c 100644 --- a/src/objective-c/tests/RxLibraryUnitTests.m +++ b/src/objective-c/tests/RxLibraryUnitTests.m @@ -34,35 +34,107 @@ #import #import +#import #import #import -@interface RxLibraryUnitTests : XCTestCase +// A mock of a GRXSingleValueHandler block that can be queried for how many times it was called and +// what were the last values passed to it. +// +// TODO(jcanizales): Move this to a test util library, and add tests for it. +@interface CapturingSingleValueHandler : NSObject +@property (nonatomic, readonly) void (^block)(id value, NSError *errorOrNil); +@property (nonatomic, readonly) NSUInteger timesCalled; +@property (nonatomic, readonly) id value; +@property (nonatomic, readonly) NSError *errorOrNil; ++ (instancetype)handler; +@end +@implementation CapturingSingleValueHandler ++ (instancetype)handler { + return [[self alloc] init]; +} + +- (GRXSingleValueHandler)block { + return ^(id value, NSError *errorOrNil) { + ++_timesCalled; + _value = value; + _errorOrNil = errorOrNil; + }; +} +@end + +@interface RxLibraryUnitTests : XCTestCase @end @implementation RxLibraryUnitTests -- (void)setUp { - [super setUp]; - // Put setup code here. This method is called before the invocation of each test method in the class. +#pragma mark Writeable + +- (void)testWriteableSingleValueHandlerIsCalledForValue { + // Given: + CapturingSingleValueHandler *handler = [CapturingSingleValueHandler handler]; + id anyValue = @7; + + // If: + id writeable = [GRXWriteable writeableWithSingleValueHandler:handler.block]; + [writeable writeValue:anyValue]; + + // Then: + XCTAssertEqual(handler.timesCalled, 1); + XCTAssertEqualObjects(handler.value, anyValue); + XCTAssertEqualObjects(handler.errorOrNil, nil); } -- (void)tearDown { - // Put teardown code here. This method is called after the invocation of each test method in the class. - [super tearDown]; +- (void)testWriteableSingleValueHandlerIsCalledForError { + // Given: + CapturingSingleValueHandler *handler = [CapturingSingleValueHandler handler]; + NSError *anyError = [NSError errorWithDomain:@"domain" code:7 userInfo:nil]; + + // If: + id writeable = [GRXWriteable writeableWithSingleValueHandler:handler.block]; + [writeable writesFinishedWithError:anyError]; + + // Then: + XCTAssertEqual(handler.timesCalled, 1); + XCTAssertEqualObjects(handler.value, nil); + XCTAssertEqualObjects(handler.errorOrNil, anyError); } -- (void)testExample { - // This is an example of a functional test case. - XCTAssert(YES, @"Pass"); +#pragma mark BufferedPipe + +- (void)testBufferedPipePropagatesValue { + // Given: + CapturingSingleValueHandler *handler = [CapturingSingleValueHandler handler]; + id writeable = [GRXWriteable writeableWithSingleValueHandler:handler.block]; + id anyValue = @7; + + // If: + GRXBufferedPipe *pipe = [GRXBufferedPipe pipe]; + [pipe startWithWriteable:writeable]; + [pipe writeValue:anyValue]; + + // Then: + XCTAssertEqual(handler.timesCalled, 1); + XCTAssertEqualObjects(handler.value, anyValue); + XCTAssertEqualObjects(handler.errorOrNil, nil); } -- (void)testPerformanceExample { - // This is an example of a performance test case. - [self measureBlock:^{ - // Put the code you want to measure the time of here. - }]; +- (void)testBufferedPipePropagatesError { + // Given: + CapturingSingleValueHandler *handler = [CapturingSingleValueHandler handler]; + id writeable = [GRXWriteable writeableWithSingleValueHandler:handler.block]; + NSError *anyError = [NSError errorWithDomain:@"domain" code:7 userInfo:nil]; + + // If: + GRXBufferedPipe *pipe = [GRXBufferedPipe pipe]; + [pipe startWithWriteable:writeable]; + [pipe writesFinishedWithError:anyError]; + + // Then: + XCTAssertEqual(handler.timesCalled, 1); + XCTAssertEqualObjects(handler.value, nil); + XCTAssertEqualObjects(handler.errorOrNil, anyError); } @end From eb1509c18c3a0cd8a5e8b1933134da4f221403d5 Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Thu, 28 May 2015 22:50:17 -0700 Subject: [PATCH 5/5] Remove empty class AllTests --- src/objective-c/tests/AllTests.m | 65 ------------------- .../tests/Tests.xcodeproj/project.pbxproj | 4 -- 2 files changed, 69 deletions(-) delete mode 100644 src/objective-c/tests/AllTests.m diff --git a/src/objective-c/tests/AllTests.m b/src/objective-c/tests/AllTests.m deleted file mode 100644 index d5b452a0b46..00000000000 --- a/src/objective-c/tests/AllTests.m +++ /dev/null @@ -1,65 +0,0 @@ -/* - * - * Copyright 2015, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#import -#import - -@interface AllTests : XCTestCase - -@end - -@implementation AllTests - -- (void)setUp { - [super setUp]; - // Put setup code here. This method is called before the invocation of each test method in the class. -} - -- (void)tearDown { - // Put teardown code here. This method is called after the invocation of each test method in the class. - [super tearDown]; -} - -- (void)testExample { - // This is an example of a functional test case. - XCTAssert(YES, @"Pass"); -} - -- (void)testPerformanceExample { - // This is an example of a performance test case. - [self measureBlock:^{ - // Put the code you want to measure the time of here. - }]; -} - -@end diff --git a/src/objective-c/tests/Tests.xcodeproj/project.pbxproj b/src/objective-c/tests/Tests.xcodeproj/project.pbxproj index aae34e389da..80059b7cbe8 100644 --- a/src/objective-c/tests/Tests.xcodeproj/project.pbxproj +++ b/src/objective-c/tests/Tests.xcodeproj/project.pbxproj @@ -7,7 +7,6 @@ objects = { /* Begin PBXBuildFile section */ - 63423F491B150A5F006CF63C /* AllTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 63423F481B150A5F006CF63C /* AllTests.m */; }; 63423F4A1B150A5F006CF63C /* libTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 635697C71B14FC11007A7283 /* libTests.a */; }; 63423F511B151B77006CF63C /* RxLibraryUnitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 63423F501B151B77006CF63C /* RxLibraryUnitTests.m */; }; 635697CD1B14FC11007A7283 /* Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = 635697CC1B14FC11007A7283 /* Tests.m */; }; @@ -40,7 +39,6 @@ 0A4F89D9C90E9C30990218F0 /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = ""; }; 35F2B6BF3BAE8F0DC4AFD76E /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; }; 63423F441B150A5F006CF63C /* AllTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AllTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 63423F481B150A5F006CF63C /* AllTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AllTests.m; sourceTree = ""; }; 63423F501B151B77006CF63C /* RxLibraryUnitTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RxLibraryUnitTests.m; sourceTree = ""; }; 635697C71B14FC11007A7283 /* libTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libTests.a; sourceTree = BUILT_PRODUCTS_DIR; }; 635697CC1B14FC11007A7283 /* Tests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Tests.m; sourceTree = ""; }; @@ -108,7 +106,6 @@ isa = PBXGroup; children = ( 63423F501B151B77006CF63C /* RxLibraryUnitTests.m */, - 63423F481B150A5F006CF63C /* AllTests.m */, 635697CC1B14FC11007A7283 /* Tests.m */, 635697D71B14FC11007A7283 /* Supporting Files */, ); @@ -246,7 +243,6 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 63423F491B150A5F006CF63C /* AllTests.m in Sources */, 63423F511B151B77006CF63C /* RxLibraryUnitTests.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0;