[37356] branches/gsoc08-framework/MacPorts.Framework
armahg at macports.org
armahg at macports.org
Wed Jun 4 05:25:12 PDT 2008
Revision: 37356
http://trac.macosforge.org/projects/macports/changeset/37356
Author: armahg at macports.org
Date: 2008-06-04 05:25:10 -0700 (Wed, 04 Jun 2008)
Log Message:
-----------
Added MPInterpreterAlt class and its tests
Modified Paths:
--------------
branches/gsoc08-framework/MacPorts.Framework/MPMacPortsTest.h
branches/gsoc08-framework/MacPorts.Framework/MPMacPortsTest.m
branches/gsoc08-framework/MacPorts.Framework/MacPorts.Framework.xcodeproj/project.pbxproj
Added Paths:
-----------
branches/gsoc08-framework/MacPorts.Framework/MPInterpreterAlt.h
branches/gsoc08-framework/MacPorts.Framework/MPInterpreterAlt.m
branches/gsoc08-framework/MacPorts.Framework/MPInterpreterAltTest.h
branches/gsoc08-framework/MacPorts.Framework/MPInterpreterAltTest.m
Added: branches/gsoc08-framework/MacPorts.Framework/MPInterpreterAlt.h
===================================================================
--- branches/gsoc08-framework/MacPorts.Framework/MPInterpreterAlt.h (rev 0)
+++ branches/gsoc08-framework/MacPorts.Framework/MPInterpreterAlt.h 2008-06-04 12:25:10 UTC (rev 37356)
@@ -0,0 +1,52 @@
+/*
+ * $Id:$
+ * MacPorts.Framework
+ *
+ * Authors:
+ * George Armah <armahg at macports.org>
+ *
+ * Copyright (c) 2008 George Armah <armahg 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.
+ */
+
+
+/*Due to issues we are having with unit testing the main MPInterpreter
+ *class, I am creating this alternate class that doesn't take different
+ *threads into account. I will suggest that the coding for multithreading
+ *be done at a level above the framework rather than within the framework.
+ *If this class does give the same issues, that is.
+ */
+
+
+#import <Cocoa/Cocoa.h>
+#import "MPInterpreter.h"
+
+ at interface MPInterpreterAlt : MPInterpreter {
+
+}
+
+ at end
Added: branches/gsoc08-framework/MacPorts.Framework/MPInterpreterAlt.m
===================================================================
--- branches/gsoc08-framework/MacPorts.Framework/MPInterpreterAlt.m (rev 0)
+++ branches/gsoc08-framework/MacPorts.Framework/MPInterpreterAlt.m 2008-06-04 12:25:10 UTC (rev 37356)
@@ -0,0 +1,69 @@
+/*
+ * $Id:$
+ * MacPorts.Framework
+ *
+ * Authors:
+ * George Armah <armahg at macports.org>
+ *
+ * Copyright (c) 2008 George Armah <armahg 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 "MPInterpreterAlt.h"
+
+
+ at implementation MPInterpreterAlt
+
+static MPInterpreterAlt *sharedInterpreter = nil;
+
++ (MPInterpreter*)sharedInterpreter {
+ //@synchronized(self) {
+ if (sharedInterpreter == nil) {
+ [[self alloc] init]; // assignment not done here
+ }
+ //}
+ return sharedInterpreter;
+}
+
++ (id)allocWithZone:(NSZone*)zone {
+ //@synchronized(self) {
+ if (sharedInterpreter == nil) {
+ /*We need the super-super of this class since it is subclassing
+ *MPInterpreter and doing just super will call an allocWithZone method
+ *that contains the thread code we are trying to avoid
+ */
+ sharedInterpreter = [[super superclass] allocWithZone:zone];
+ return sharedInterpreter; // assignment and return on first allocation
+ }
+ //}
+ return nil; // subsequent allocation attempts return nil
+}
+
+
+ at end
Added: branches/gsoc08-framework/MacPorts.Framework/MPInterpreterAltTest.h
===================================================================
--- branches/gsoc08-framework/MacPorts.Framework/MPInterpreterAltTest.h (rev 0)
+++ branches/gsoc08-framework/MacPorts.Framework/MPInterpreterAltTest.h 2008-06-04 12:25:10 UTC (rev 37356)
@@ -0,0 +1,51 @@
+/*
+ * $Id:$
+ * MacPorts.Framework
+ *
+ * Authors:
+ * George Armah <armahg at macports.org>
+ *
+ * Copyright (c) 2008 George Armah <armahg 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 "MPInterpreterAlt.h"
+
+
+ at interface MPInterpreterAltTest : SenTestCase {
+ MPInterpreterAlt *interpreter;
+}
+
+- (void)testSharedInterpreter;
+
+/*
+- (void)testGetVariableArray;
+ */
+
+ at end
Added: branches/gsoc08-framework/MacPorts.Framework/MPInterpreterAltTest.m
===================================================================
--- branches/gsoc08-framework/MacPorts.Framework/MPInterpreterAltTest.m (rev 0)
+++ branches/gsoc08-framework/MacPorts.Framework/MPInterpreterAltTest.m 2008-06-04 12:25:10 UTC (rev 37356)
@@ -0,0 +1,30 @@
+//
+// MPInterpreterAltTest.m
+// MacPorts.Framework
+//
+// Created by George Armah on 6/3/08.
+// Copyright 2008 __MyCompanyName__. All rights reserved.
+//
+
+#import "MPInterpreterAltTest.h"
+
+
+ at implementation MPInterpreterAltTest
+- (void) setUp {
+ interpreter = [MPInterpreterAlt sharedInterpreter];
+}
+
+- (void) tearDown {
+ [interpreter release];
+}
+
+- (void)testSharedInterpreter {
+ STAssertNotNil(interpreter, @"Should not be nil");
+}
+
+/*
+- (void)testGetVariableArray {
+ STAssertEquals([[interpreter getVariableAsArray:@"macports::sources"] count], 0, @"Empty array returned when should have at least 1 element.");
+}
+*/
+ at end
Modified: branches/gsoc08-framework/MacPorts.Framework/MPMacPortsTest.h
===================================================================
--- branches/gsoc08-framework/MacPorts.Framework/MPMacPortsTest.h 2008-06-04 10:51:38 UTC (rev 37355)
+++ branches/gsoc08-framework/MacPorts.Framework/MPMacPortsTest.h 2008-06-04 12:25:10 UTC (rev 37356)
@@ -3,10 +3,9 @@
* 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>
+ * Copyright (c) 2008 George Armah <armahg at macports.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -41,8 +40,9 @@
MPMacPorts *testPort;
}
-
+/*
-(void)testPortCreation;
-(void) testPrefix;
+*/
@end
Modified: branches/gsoc08-framework/MacPorts.Framework/MPMacPortsTest.m
===================================================================
--- branches/gsoc08-framework/MacPorts.Framework/MPMacPortsTest.m 2008-06-04 10:51:38 UTC (rev 37355)
+++ branches/gsoc08-framework/MacPorts.Framework/MPMacPortsTest.m 2008-06-04 12:25:10 UTC (rev 37356)
@@ -18,7 +18,7 @@
[testPort release];
}
-
+/*
- (void) testPortCreation {
STAssertNotNil(testPort, @"Should not be nil");
}
@@ -29,5 +29,6 @@
STAssertNotNil(prefix, @" %@ should not be nil", prefix);
[prefix release];
}
-
+*/
+
@end
Modified: branches/gsoc08-framework/MacPorts.Framework/MacPorts.Framework.xcodeproj/project.pbxproj
===================================================================
--- branches/gsoc08-framework/MacPorts.Framework/MacPorts.Framework.xcodeproj/project.pbxproj 2008-06-04 10:51:38 UTC (rev 37355)
+++ branches/gsoc08-framework/MacPorts.Framework/MacPorts.Framework.xcodeproj/project.pbxproj 2008-06-04 12:25:10 UTC (rev 37356)
@@ -41,6 +41,8 @@
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 */; };
+ 6E88D3270DF5FE3A00684E9F /* MPInterpreterAlt.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E88D3260DF5FE3A00684E9F /* MPInterpreterAlt.m */; };
+ 6E88D34C0DF6026000684E9F /* MPInterpreterAltTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E88D34B0DF6026000684E9F /* MPInterpreterAltTest.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 */
@@ -86,6 +88,10 @@
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>"; };
+ 6E88D3250DF5FE3A00684E9F /* MPInterpreterAlt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPInterpreterAlt.h; sourceTree = "<group>"; };
+ 6E88D3260DF5FE3A00684E9F /* MPInterpreterAlt.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPInterpreterAlt.m; sourceTree = "<group>"; };
+ 6E88D34A0DF6026000684E9F /* MPInterpreterAltTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPInterpreterAltTest.h; sourceTree = "<group>"; };
+ 6E88D34B0DF6026000684E9F /* MPInterpreterAltTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPInterpreterAltTest.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; };
@@ -123,6 +129,7 @@
0867D691FE84028FC02AAC07 /* MacPorts Foundation */ = {
isa = PBXGroup;
children = (
+ 6E88D3280DF5FFA000684E9F /* AlternateClasses */,
6E88D1760DF46A2600684E9F /* Tests */,
08FB77AEFE84172EC02AAC07 /* Classes */,
32C88DFF0371C24200C91783 /* Other Sources */,
@@ -219,10 +226,21 @@
489DD92E0C94674B00595506 /* MPInterpreterTest.m */,
6E88D1CA0DF4B90B00684E9F /* MPMacPortsTest.h */,
6E88D1CB0DF4B90B00684E9F /* MPMacPortsTest.m */,
+ 6E88D34A0DF6026000684E9F /* MPInterpreterAltTest.h */,
+ 6E88D34B0DF6026000684E9F /* MPInterpreterAltTest.m */,
);
name = Tests;
sourceTree = "<group>";
};
+ 6E88D3280DF5FFA000684E9F /* AlternateClasses */ = {
+ isa = PBXGroup;
+ children = (
+ 6E88D3250DF5FE3A00684E9F /* MPInterpreterAlt.h */,
+ 6E88D3260DF5FE3A00684E9F /* MPInterpreterAlt.m */,
+ );
+ name = AlternateClasses;
+ sourceTree = "<group>";
+ };
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
@@ -361,6 +379,8 @@
489DD92F0C94674B00595506 /* MPInterpreterTest.m in Sources */,
481D04A40CDAAAFD00D4A550 /* MPMutableDictionary.m in Sources */,
6E88D1CC0DF4B90B00684E9F /* MPMacPortsTest.m in Sources */,
+ 6E88D3270DF5FE3A00684E9F /* MPInterpreterAlt.m in Sources */,
+ 6E88D34C0DF6026000684E9F /* MPInterpreterAltTest.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20080604/eb87958d/attachment.htm
More information about the macports-changes
mailing list