[37345] branches/gsoc08-framework/MacPorts.Framework

armahg at macports.org armahg at macports.org
Tue Jun 3 15:28:12 PDT 2008


Revision: 37345
          http://trac.macosforge.org/projects/macports/changeset/37345
Author:   armahg at macports.org
Date:     2008-06-03 15:28:11 -0700 (Tue, 03 Jun 2008)

Log Message:
-----------
Working on unit testing base framework classes

Modified Paths:
--------------
    branches/gsoc08-framework/MacPorts.Framework/MPInterpreter.h
    branches/gsoc08-framework/MacPorts.Framework/MPInterpreter.m
    branches/gsoc08-framework/MacPorts.Framework/MPInterpreterTest.h
    branches/gsoc08-framework/MacPorts.Framework/MPInterpreterTest.m
    branches/gsoc08-framework/MacPorts.Framework/MacPorts.Framework.xcodeproj/project.pbxproj

Added Paths:
-----------
    branches/gsoc08-framework/MacPorts.Framework/MPMacPortsTest.h
    branches/gsoc08-framework/MacPorts.Framework/MPMacPortsTest.m

Modified: branches/gsoc08-framework/MacPorts.Framework/MPInterpreter.h
===================================================================
--- branches/gsoc08-framework/MacPorts.Framework/MPInterpreter.h	2008-06-03 22:20:38 UTC (rev 37344)
+++ branches/gsoc08-framework/MacPorts.Framework/MPInterpreter.h	2008-06-03 22:28:11 UTC (rev 37345)
@@ -47,6 +47,11 @@
 
 + (MPInterpreter *)sharedInterpreter;
 
+/*A version of sharedInterpreter that doesn't safeguard against
+ *multi-threading. Use for Unit Testing Purposes only
+ */
++ (MPInterpreter *) ocSharedInterpreter;
+
 #pragma Port Operations
 
 #pragma Port Settings
@@ -63,4 +68,6 @@
 - (NSArray *)getVariableAsArray:(NSString *)variable;
 - (NSString *)getVariableAsString:(NSString *)variable;
 
+
+
 @end

Modified: branches/gsoc08-framework/MacPorts.Framework/MPInterpreter.m
===================================================================
--- branches/gsoc08-framework/MacPorts.Framework/MPInterpreter.m	2008-06-03 22:20:38 UTC (rev 37344)
+++ branches/gsoc08-framework/MacPorts.Framework/MPInterpreter.m	2008-06-03 22:28:11 UTC (rev 37345)
@@ -26,8 +26,8 @@
  *	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
+ *	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.
@@ -64,6 +64,17 @@
 	return [[[NSThread currentThread] threadDictionary] objectForKey:@"sharedMPInterpreter"];
 }
 
++ (MPInterpreter*)ocSharedInterpreter {	
+	if ([[[NSThread currentThread] threadDictionary] objectForKey:@"sharedMPInterpreter"] == nil) {
+		[[self alloc] init]; // assignment not done here
+	}
+	return [[[NSThread currentThread] threadDictionary] objectForKey:@"sharedMPInterpreter"];
+}
+
+
+
+
+
 + (id)allocWithZone:(NSZone*)zone {
 	@synchronized(self) {
 		if ([[[NSThread currentThread] threadDictionary] objectForKey:@"sharedMPInterpreter"] == nil) {

Modified: branches/gsoc08-framework/MacPorts.Framework/MPInterpreterTest.h
===================================================================
--- branches/gsoc08-framework/MacPorts.Framework/MPInterpreterTest.h	2008-06-03 22:20:38 UTC (rev 37344)
+++ branches/gsoc08-framework/MacPorts.Framework/MPInterpreterTest.h	2008-06-03 22:28:11 UTC (rev 37345)
@@ -39,6 +39,9 @@
 
 }
 
+/*
+- (void)testOcSharedInterpreter;
 - (void)testGetVariableArray;
+*/
 
 @end

Modified: branches/gsoc08-framework/MacPorts.Framework/MPInterpreterTest.m
===================================================================
--- branches/gsoc08-framework/MacPorts.Framework/MPInterpreterTest.m	2008-06-03 22:20:38 UTC (rev 37344)
+++ branches/gsoc08-framework/MacPorts.Framework/MPInterpreterTest.m	2008-06-03 22:28:11 UTC (rev 37345)
@@ -38,9 +38,20 @@
 
 @implementation MPInterpreterTest
 
+/*
+- (void)testOCsharedInterpreter {
+	MPInterpreter *interpreter = [MPInterpreter ocSharedInterpreter];
+	STAssertNotNil(interpreter, @"Should not be nil");
+	
+}
+
+
 - (void)testGetVariableArray {
 	MPInterpreter *interpreter = [MPInterpreter sharedInterpreter];
-	STAssertEquals([[interpreter getVariableAsArray:@"macports::sources"] count], 0, "Empty array returned when should have at least 1 element.");
+	STAssertEquals([[interpreter getVariableAsArray:@"macports::sources"] count], 0, @"Empty array returned when should have at least 1 element.");
 }
+ 
+*/
 
+
 @end

Added: branches/gsoc08-framework/MacPorts.Framework/MPMacPortsTest.h
===================================================================
--- branches/gsoc08-framework/MacPorts.Framework/MPMacPortsTest.h	                        (rev 0)
+++ branches/gsoc08-framework/MacPorts.Framework/MPMacPortsTest.h	2008-06-03 22:28:11 UTC (rev 37345)
@@ -0,0 +1,48 @@
+/*
+ *	$Id:$
+ *	MacPorts.Framework
+ *
+ *	Authors:
+ * 	Randall H. Wood <rhwood at macports.org>
+ *	George Armah <armahg at macports.org>
+ *
+ *	Copyright (c) 2007 Randall H. Wood <rhwood at macports.org>
+ *	All rights reserved.
+ *
+ *	Redistribution and use in source and binary forms, with or without
+ *	modification, are permitted provided that the following conditions
+ *	are met:
+ *	1.	Redistributions of source code must retain the above copyright
+ *		notice, this list of conditions and the following disclaimer.
+ *	2.	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.
+ *	3.	Neither the name of the copyright owner nor the names of 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 <SenTestingKit/SenTestingKit.h>
+#import "MPMacPorts.h"
+
+ at interface MPMacPortsTest : SenTestCase {
+	MPMacPorts *testPort;
+}
+
+
+-(void)testPortCreation;
+-(void) testPrefix;
+
+ at end

Added: branches/gsoc08-framework/MacPorts.Framework/MPMacPortsTest.m
===================================================================
--- branches/gsoc08-framework/MacPorts.Framework/MPMacPortsTest.m	                        (rev 0)
+++ branches/gsoc08-framework/MacPorts.Framework/MPMacPortsTest.m	2008-06-03 22:28:11 UTC (rev 37345)
@@ -0,0 +1,33 @@
+//
+//  MPMacPortsTest.m
+//  MacPorts.Framework
+//
+//  Created by George  Armah on 6/2/08.
+//  Copyright 2008 __MyCompanyName__. All rights reserved.
+//
+
+#import "MPMacPortsTest.h"
+
+
+ at implementation MPMacPortsTest
+- (void) setUp {
+	testPort = [[MPMacPorts alloc] init];
+}
+
+- (void) tearDown {
+	[testPort release];
+}
+
+
+- (void) testPortCreation {
+	STAssertNotNil(testPort, @"Should not be nil");
+}
+
+
+- (void) testPrefix {
+	NSString *prefix = [testPort prefix];
+	STAssertNotNil(prefix, @" %@ should not be nil", prefix);
+	[prefix release];
+}
+
+ at end

Modified: branches/gsoc08-framework/MacPorts.Framework/MacPorts.Framework.xcodeproj/project.pbxproj
===================================================================
--- branches/gsoc08-framework/MacPorts.Framework/MacPorts.Framework.xcodeproj/project.pbxproj	2008-06-03 22:20:38 UTC (rev 37344)
+++ branches/gsoc08-framework/MacPorts.Framework/MacPorts.Framework.xcodeproj/project.pbxproj	2008-06-03 22:28:11 UTC (rev 37345)
@@ -40,6 +40,7 @@
 		48E993940C82CAAE00219DDF /* MPMacPorts.h in Headers */ = {isa = PBXBuildFile; fileRef = 48E993920C82CAAE00219DDF /* MPMacPorts.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		48E993950C82CAAE00219DDF /* MPMacPorts.m in Sources */ = {isa = PBXBuildFile; fileRef = 48E993930C82CAAE00219DDF /* MPMacPorts.m */; };
 		48E9939F0C82CEB000219DDF /* init.tcl in Resources */ = {isa = PBXBuildFile; fileRef = 48E9939E0C82CEB000219DDF /* init.tcl */; };
+		6E88D1CC0DF4B90B00684E9F /* MPMacPortsTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E88D1CB0DF4B90B00684E9F /* MPMacPortsTest.m */; };
 		8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C1666FE841158C02AAC07 /* InfoPlist.strings */; };
 		8DC2EF570486A6940098B216 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */; };
 /* End PBXBuildFile section */
@@ -83,6 +84,8 @@
 		48E9939E0C82CEB000219DDF /* init.tcl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = init.tcl; sourceTree = "<group>"; };
 		48F811BE0CE4636A009630DE /* MPRegistry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPRegistry.h; sourceTree = "<group>"; };
 		48F811BF0CE4638C009630DE /* MPRegistry.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPRegistry.m; sourceTree = "<group>"; };
+		6E88D1CA0DF4B90B00684E9F /* MPMacPortsTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPMacPortsTest.h; sourceTree = "<group>"; };
+		6E88D1CB0DF4B90B00684E9F /* MPMacPortsTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPMacPortsTest.m; sourceTree = "<group>"; };
 		6EAFD8B70DEC614E00E97270 /* dummycommit.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = dummycommit.test; sourceTree = "<group>"; };
 		8DC2EF5A0486A6940098B216 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
 		8DC2EF5B0486A6940098B216 /* MacPorts.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = MacPorts.framework; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -120,6 +123,7 @@
 		0867D691FE84028FC02AAC07 /* MacPorts Foundation */ = {
 			isa = PBXGroup;
 			children = (
+				6E88D1760DF46A2600684E9F /* Tests */,
 				08FB77AEFE84172EC02AAC07 /* Classes */,
 				32C88DFF0371C24200C91783 /* Other Sources */,
 				089C1665FE841158C02AAC07 /* Resources */,
@@ -158,8 +162,6 @@
 				487679540C98C2EB00577C59 /* MPIndex.m */,
 				48906AFB0C4230B700A3ED8A /* MPInterpreter.h */,
 				48906AFC0C4230B700A3ED8A /* MPInterpreter.m */,
-				489DD92D0C94674B00595506 /* MPInterpreterTest.h */,
-				489DD92E0C94674B00595506 /* MPInterpreterTest.m */,
 				48E993920C82CAAE00219DDF /* MPMacPorts.h */,
 				48E993930C82CAAE00219DDF /* MPMacPorts.m */,
 				481D04A00CDAAAFC00D4A550 /* MPMutableDictionary.h */,
@@ -210,6 +212,17 @@
 			name = Documentation;
 			sourceTree = "<group>";
 		};
+		6E88D1760DF46A2600684E9F /* Tests */ = {
+			isa = PBXGroup;
+			children = (
+				489DD92D0C94674B00595506 /* MPInterpreterTest.h */,
+				489DD92E0C94674B00595506 /* MPInterpreterTest.m */,
+				6E88D1CA0DF4B90B00684E9F /* MPMacPortsTest.h */,
+				6E88D1CB0DF4B90B00684E9F /* MPMacPortsTest.m */,
+			);
+			name = Tests;
+			sourceTree = "<group>";
+		};
 /* End PBXGroup section */
 
 /* Begin PBXHeadersBuildPhase section */
@@ -274,6 +287,9 @@
 /* Begin PBXProject section */
 		0867D690FE84028FC02AAC07 /* Project object */ = {
 			isa = PBXProject;
+			attributes = {
+				BuildIndependentTargetsInParallel = NO;
+			};
 			buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "MacPorts.Framework" */;
 			compatibilityVersion = "Xcode 2.4";
 			hasScannedForEncodings = 1;
@@ -344,6 +360,7 @@
 			files = (
 				489DD92F0C94674B00595506 /* MPInterpreterTest.m in Sources */,
 				481D04A40CDAAAFD00D4A550 /* MPMutableDictionary.m in Sources */,
+				6E88D1CC0DF4B90B00684E9F /* MPMacPortsTest.m in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -386,6 +403,10 @@
 		1DEB91AE08733DA50010E9CD /* Debug */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
+				ARCHS = (
+					"$(NATIVE_ARCH)",
+					ppc,
+				);
 				COPY_PHASE_STRIP = NO;
 				DYLIB_COMPATIBILITY_VERSION = 1;
 				DYLIB_CURRENT_VERSION = 1;
@@ -431,6 +452,10 @@
 		1DEB91B208733DA50010E9CD /* Debug */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
+				ARCHS = (
+					"$(NATIVE_ARCH)",
+					ppc,
+				);
 				GCC_WARN_ABOUT_RETURN_TYPE = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
 				PREBINDING = NO;
@@ -442,6 +467,10 @@
 		1DEB91B308733DA50010E9CD /* Release */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
+				ARCHS = (
+					"$(NATIVE_ARCH)",
+					ppc,
+				);
 				GCC_WARN_ABOUT_RETURN_TYPE = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
 				PREBINDING = NO;
@@ -453,6 +482,10 @@
 		489DD8F70C94366000595506 /* Debug */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
+				ARCHS = (
+					"$(NATIVE_ARCH_32_BIT)",
+					ppc,
+				);
 				BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/MacPorts.framework/MacPorts";
 				COPY_PHASE_STRIP = NO;
 				FRAMEWORK_SEARCH_PATHS = (

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20080603/feca901f/attachment-0001.htm 


More information about the macports-changes mailing list