Commits

Kunal Parmar committed 6978c0a

Adding a new target for unittest.

Comments (0)

Files changed (6)

KPT.xcodeproj/project.pbxproj

 /* Begin PBXBuildFile section */
 		E73BBF4E154B668200A3FA0D /* KPTNSObject+Foundation.h in Headers */ = {isa = PBXBuildFile; fileRef = E73BBF4C154B668200A3FA0D /* KPTNSObject+Foundation.h */; };
 		E73BBF4F154B668200A3FA0D /* KPTNSObject+Foundation.m in Sources */ = {isa = PBXBuildFile; fileRef = E73BBF4D154B668200A3FA0D /* KPTNSObject+Foundation.m */; };
+		E73BBF5C154B8FAC00A3FA0D /* SenTestingKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E7B87D8F154B50A5000E3E0A /* SenTestingKit.framework */; };
+		E73BBF78154B91E200A3FA0D /* KPTNSObject+FoundationTest.m in Sources */ = {isa = PBXBuildFile; fileRef = E73BBF77154B91E200A3FA0D /* KPTNSObject+FoundationTest.m */; };
+		E73BBF7C154B942F00A3FA0D /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E7B87D7E154B50A5000E3E0A /* Foundation.framework */; };
+		E73BBF7D154B943D00A3FA0D /* KPT.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E794A567154B5BA60013843F /* KPT.framework */; };
 		E794A568154B5BA60013843F /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E7B87D79154B50A5000E3E0A /* Cocoa.framework */; };
 /* End PBXBuildFile section */
 
+/* Begin PBXContainerItemProxy section */
+		E73BBF79154B93F000A3FA0D /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = E7B87D6C154B50A5000E3E0A /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = E794A566154B5BA60013843F;
+			remoteInfo = KPTFramework;
+		};
+/* End PBXContainerItemProxy section */
+
 /* Begin PBXFileReference section */
 		E73BBF4C154B668200A3FA0D /* KPTNSObject+Foundation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "KPTNSObject+Foundation.h"; sourceTree = "<group>"; };
 		E73BBF4D154B668200A3FA0D /* KPTNSObject+Foundation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "KPTNSObject+Foundation.m"; sourceTree = "<group>"; };
+		E73BBF5B154B8FAC00A3FA0D /* KPTFrameworkTests.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = KPTFrameworkTests.octest; sourceTree = BUILT_PRODUCTS_DIR; };
+		E73BBF6F154B8FDA00A3FA0D /* KPTFrameworkTests-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "KPTFrameworkTests-Info.plist"; sourceTree = "<group>"; };
+		E73BBF71154B900600A3FA0D /* KPTFrameworkTests.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = KPTFrameworkTests.xcconfig; sourceTree = "<group>"; };
+		E73BBF77154B91E200A3FA0D /* KPTNSObject+FoundationTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "KPTNSObject+FoundationTest.m"; sourceTree = "<group>"; };
 		E794A52A154B562F0013843F /* KPTShared.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = KPTShared.xcconfig; sourceTree = "<group>"; };
 		E794A52C154B57CA0013843F /* KPTSharedDebug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = KPTSharedDebug.xcconfig; sourceTree = "<group>"; };
 		E794A52D154B58050013843F /* KPTSharedRelease.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = KPTSharedRelease.xcconfig; sourceTree = "<group>"; };
 /* End PBXFileReference section */
 
 /* Begin PBXFrameworksBuildPhase section */
+		E73BBF57154B8FAC00A3FA0D /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				E73BBF7C154B942F00A3FA0D /* Foundation.framework in Frameworks */,
+				E73BBF5C154B8FAC00A3FA0D /* SenTestingKit.framework in Frameworks */,
+				E73BBF7D154B943D00A3FA0D /* KPT.framework in Frameworks */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
 		E794A563154B5BA60013843F /* Frameworks */ = {
 			isa = PBXFrameworksBuildPhase;
 			buildActionMask = 2147483647;
 			children = (
 				E73BBF4C154B668200A3FA0D /* KPTNSObject+Foundation.h */,
 				E73BBF4D154B668200A3FA0D /* KPTNSObject+Foundation.m */,
+				E73BBF77154B91E200A3FA0D /* KPTNSObject+FoundationTest.m */,
 			);
 			path = Sources;
 			sourceTree = SOURCE_ROOT;
 			isa = PBXGroup;
 			children = (
 				E794A58D154B5BCC0013843F /* KPTFramework.xcconfig */,
+				E73BBF71154B900600A3FA0D /* KPTFrameworkTests.xcconfig */,
 			);
 			path = Target;
 			sourceTree = "<group>";
 			isa = PBXGroup;
 			children = (
 				E794A590154B5C7F0013843F /* KPTFramework-Info.plist */,
+				E73BBF6F154B8FDA00A3FA0D /* KPTFrameworkTests-Info.plist */,
 			);
 			path = Plist;
 			sourceTree = "<group>";
 			isa = PBXGroup;
 			children = (
 				E794A567154B5BA60013843F /* KPT.framework */,
+				E73BBF5B154B8FAC00A3FA0D /* KPTFrameworkTests.octest */,
 			);
 			name = Products;
 			sourceTree = "<group>";
 /* End PBXHeadersBuildPhase section */
 
 /* Begin PBXNativeTarget section */
+		E73BBF5A154B8FAC00A3FA0D /* KPTFrameworkTests */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = E73BBF6C154B8FAC00A3FA0D /* Build configuration list for PBXNativeTarget "KPTFrameworkTests" */;
+			buildPhases = (
+				E73BBF56154B8FAC00A3FA0D /* Sources */,
+				E73BBF57154B8FAC00A3FA0D /* Frameworks */,
+				E73BBF58154B8FAC00A3FA0D /* Resources */,
+				E73BBF59154B8FAC00A3FA0D /* ShellScript */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+				E73BBF7A154B93F000A3FA0D /* PBXTargetDependency */,
+			);
+			name = KPTFrameworkTests;
+			productName = KPTFrameworkTests;
+			productReference = E73BBF5B154B8FAC00A3FA0D /* KPTFrameworkTests.octest */;
+			productType = "com.apple.product-type.bundle";
+		};
 		E794A566154B5BA60013843F /* KPTFramework */ = {
 			isa = PBXNativeTarget;
 			buildConfigurationList = E794A587154B5BA60013843F /* Build configuration list for PBXNativeTarget "KPTFramework" */;
 			projectRoot = "";
 			targets = (
 				E794A566154B5BA60013843F /* KPTFramework */,
+				E73BBF5A154B8FAC00A3FA0D /* KPTFrameworkTests */,
 			);
 		};
 /* End PBXProject section */
 
 /* Begin PBXResourcesBuildPhase section */
+		E73BBF58154B8FAC00A3FA0D /* Resources */ = {
+			isa = PBXResourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
 		E794A565154B5BA60013843F /* Resources */ = {
 			isa = PBXResourcesBuildPhase;
 			buildActionMask = 2147483647;
 		};
 /* End PBXResourcesBuildPhase section */
 
+/* Begin PBXShellScriptBuildPhase section */
+		E73BBF59154B8FAC00A3FA0D /* ShellScript */ = {
+			isa = PBXShellScriptBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			inputPaths = (
+			);
+			outputPaths = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+			shellPath = /bin/sh;
+			shellScript = "# Run the unit tests in this test bundle.\n\"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests\"\n";
+		};
+/* End PBXShellScriptBuildPhase section */
+
 /* Begin PBXSourcesBuildPhase section */
+		E73BBF56154B8FAC00A3FA0D /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				E73BBF78154B91E200A3FA0D /* KPTNSObject+FoundationTest.m in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
 		E794A562154B5BA60013843F /* Sources */ = {
 			isa = PBXSourcesBuildPhase;
 			buildActionMask = 2147483647;
 		};
 /* End PBXSourcesBuildPhase section */
 
+/* Begin PBXTargetDependency section */
+		E73BBF7A154B93F000A3FA0D /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = E794A566154B5BA60013843F /* KPTFramework */;
+			targetProxy = E73BBF79154B93F000A3FA0D /* PBXContainerItemProxy */;
+		};
+/* End PBXTargetDependency section */
+
 /* Begin XCBuildConfiguration section */
+		E73BBF6D154B8FAC00A3FA0D /* Debug */ = {
+			isa = XCBuildConfiguration;
+			baseConfigurationReference = E73BBF71154B900600A3FA0D /* KPTFrameworkTests.xcconfig */;
+			buildSettings = {
+				FRAMEWORK_SEARCH_PATHS = (
+					"$(inherited)",
+					"\"$(DEVELOPER_FRAMEWORKS_DIR)\"",
+				);
+			};
+			name = Debug;
+		};
+		E73BBF6E154B8FAC00A3FA0D /* Release */ = {
+			isa = XCBuildConfiguration;
+			baseConfigurationReference = E73BBF71154B900600A3FA0D /* KPTFrameworkTests.xcconfig */;
+			buildSettings = {
+				FRAMEWORK_SEARCH_PATHS = (
+					"$(inherited)",
+					"\"$(DEVELOPER_FRAMEWORKS_DIR)\"",
+				);
+			};
+			name = Release;
+		};
 		E794A588154B5BA60013843F /* Debug */ = {
 			isa = XCBuildConfiguration;
 			baseConfigurationReference = E794A58D154B5BCC0013843F /* KPTFramework.xcconfig */;
 /* End XCBuildConfiguration section */
 
 /* Begin XCConfigurationList section */
+		E73BBF6C154B8FAC00A3FA0D /* Build configuration list for PBXNativeTarget "KPTFrameworkTests" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				E73BBF6D154B8FAC00A3FA0D /* Debug */,
+				E73BBF6E154B8FAC00A3FA0D /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
 		E794A587154B5BA60013843F /* Build configuration list for PBXNativeTarget "KPTFramework" */ = {
 			isa = XCConfigurationList;
 			buildConfigurations = (

Other/Config/Target/KPTFramework.xcconfig

 
 PRODUCT_NAME = KPT
 
+// Info.plist.
+INFOPLIST_FILE = Other/Plist/KPTFramework-Info.plist
+
 // Strips non-global symbols, but saves external symbols.
 STRIP_STYLE = non-global
 

Other/Config/Target/KPTFrameworkTests.xcconfig

+//
+//  KPTFrameworkTests.xcconfig
+//
+//  Xcode configuration file for KPTFrameworkTests target.
+//
+//  Created by Kunal Parmar on 4/27/12.
+//  Copyright (c) 2012 Kunal Parmar. All rights reserved.
+//
+
+PRODUCT_NAME = $(TARGET_NAME)
+
+// List of paths to folders containing frameworks to be searched by the compiler
+// for both included or imported header files, and by the linker for frameworks
+// used by the product.
+FRAMEWORK_SEARCH_PATHS = $(DEVELOPER_LIBRARY_DIR)/Frameworks
+
+// Info.plist.
+INFOPLIST_FILE = Other/Plist/KPTFrameworkTests-Info.plist
+
+// Extension used for product wrappers.
+WRAPPER_EXTENSION = octest

Other/Plist/KPTFrameworkTests-Info.plist

+<?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>CFBundleDevelopmentRegion</key>
+	<string>en</string>
+	<key>CFBundleExecutable</key>
+	<string>${EXECUTABLE_NAME}</string>
+	<key>CFBundleIdentifier</key>
+	<string>com.kunalparmar.${PRODUCT_NAME:rfc1034identifier}</string>
+	<key>CFBundleInfoDictionaryVersion</key>
+	<string>6.0</string>
+	<key>CFBundlePackageType</key>
+	<string>BNDL</string>
+	<key>CFBundleShortVersionString</key>
+	<string>1.0</string>
+	<key>CFBundleSignature</key>
+	<string>????</string>
+	<key>CFBundleVersion</key>
+	<string>1</string>
+</dict>
+</plist>

Sources/KPTNSObject+Foundation.h

 //  Copyright (c) 2012 Kunal Parmar. All rights reserved.
 //
 
+#import <Foundation/Foundation.h>
+
 // A macro for compile time checks to make sure the property being accessed
 // using key-value coding is implemented by a class.
 //
 //  a given key.
 //
 //  Example, -[MyArray valueForKey:@"name"] would be replaced by
-//  -[MyArray valueForKey:NSStringForKey(name, MyClass)].
+//  -[MyArray valueForKey:KPT_STRING_FOR_KEY(name, MyClass)].
 //
 //  To ensure that performance is not affected, this macro is a no-op in
 //  non-Debug builds.
 #ifdef DEBUG
-  #define NSStringForKey(key, class) ([(class *)nil key], @#key)
+  #define KPT_STRING_FOR_KEY(key, class) ([(class *)nil key], @#key)
 #else
-  #define NSStringForKey(key, class) @#key
+  #define KPT_STRING_FOR_KEY(key, class) @#key
 #endif // DEBUG
 
 @interface NSObject (KPTNSObjectFoundation)

Sources/KPTNSObject+FoundationTest.m

+//
+//  KPTNSObject+FoundationTest.h
+//
+//  Created by Kunal Parmar on 4/27/12.
+//  Copyright (c) 2012 Kunal Parmar. All rights reserved.
+//
+
+#import <SenTestingKit/SenTestingKit.h>
+
+#import "KPTNSObject+Foundation.h"
+
+@interface KPTNSObject_FoundationTest : SenTestCase
+@end
+
+@implementation KPTNSObject_FoundationTest
+
+- (void)testKPTStringForKey
+{
+  STAssertEquals(KPT_STRING_FOR_KEY(retainCount, NSObject), @"retainCount",
+                 @"retainCount key not returned");
+
+  // Cannot test failure since this is compile time check.
+}
+
+@end