aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2012-09-08 12:41:19 +0000
committerstuconnolly <stuart02@gmail.com>2012-09-08 12:41:19 +0000
commit79a3dbd44f55340d2b6bd5f7e508341adaea1ad3 (patch)
tree9913f11efa0246513dad0854e53d414c3062a585
parent9f9b1599232e2a93ee910b6a2888f911eedead70 (diff)
downloadsequelpro-79a3dbd44f55340d2b6bd5f7e508341adaea1ad3.tar.gz
sequelpro-79a3dbd44f55340d2b6bd5f7e508341adaea1ad3.tar.bz2
sequelpro-79a3dbd44f55340d2b6bd5f7e508341adaea1ad3.zip
Add tests target and test script.
-rw-r--r--Frameworks/PostgresKit/PostgresKit.xcodeproj/project.pbxproj167
-rw-r--r--Frameworks/PostgresKit/Resources/TestData.sql5
-rw-r--r--Frameworks/PostgresKit/Resources/Tests-Info.plist22
-rwxr-xr-xFrameworks/PostgresKit/Scripts/build-libpq.sh2
-rwxr-xr-xFrameworks/PostgresKit/Scripts/run-tests.sh65
5 files changed, 256 insertions, 5 deletions
diff --git a/Frameworks/PostgresKit/PostgresKit.xcodeproj/project.pbxproj b/Frameworks/PostgresKit/PostgresKit.xcodeproj/project.pbxproj
index fa760468..b0e4079d 100644
--- a/Frameworks/PostgresKit/PostgresKit.xcodeproj/project.pbxproj
+++ b/Frameworks/PostgresKit/PostgresKit.xcodeproj/project.pbxproj
@@ -12,6 +12,8 @@
1724C9B815F9ED8600AB2291 /* libpqtypes.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1724C9B715F9ED8600AB2291 /* libpqtypes.a */; };
1724CC9215FB4CC200AB2291 /* FLXTimeTZ.h in Headers */ = {isa = PBXBuildFile; fileRef = 1724CC9015FB4CC200AB2291 /* FLXTimeTZ.h */; };
1724CC9315FB4CC200AB2291 /* FLXTimeTZ.m in Sources */ = {isa = PBXBuildFile; fileRef = 1724CC9115FB4CC200AB2291 /* FLXTimeTZ.m */; };
+ 1724CD1515FB69EC00AB2291 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 17E595F114F3058F0054EE08 /* Foundation.framework */; };
+ 1724CD1815FB6A0500AB2291 /* PostgresKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8DC2EF5B0486A6940098B216 /* PostgresKit.framework */; };
1731F02B15EE09E000D973EB /* FLXPostgresConnectionParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 1731F02915EE09E000D973EB /* FLXPostgresConnectionParameters.h */; };
1731F02C15EE09E000D973EB /* FLXPostgresConnectionParameters.m in Sources */ = {isa = PBXBuildFile; fileRef = 1731F02A15EE09E000D973EB /* FLXPostgresConnectionParameters.m */; };
1731F10815F1A52B00D973EB /* FLXPostgresTypeDateTimeHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 1731F10615F1A52B00D973EB /* FLXPostgresTypeDateTimeHandler.h */; };
@@ -53,6 +55,16 @@
17E595F214F3058F0054EE08 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 17E595F114F3058F0054EE08 /* Foundation.framework */; };
/* End PBXBuildFile section */
+/* Begin PBXContainerItemProxy section */
+ 1724CD1615FB69EF00AB2291 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 8DC2EF4F0486A6940098B216 /* PostgresKit */;
+ remoteInfo = PostgresKit;
+ };
+/* End PBXContainerItemProxy section */
+
/* Begin PBXFileReference section */
170465CC15C2960F00DC5BE5 /* FLXPostgresTypeHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FLXPostgresTypeHandler.h; sourceTree = "<group>"; };
170465CD15C2960F00DC5BE5 /* FLXPostgresTypeHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FLXPostgresTypeHandler.m; sourceTree = "<group>"; };
@@ -60,6 +72,8 @@
1724CA3B15F9EE7300AB2291 /* libpqtypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = libpqtypes.h; sourceTree = "<group>"; };
1724CC9015FB4CC200AB2291 /* FLXTimeTZ.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FLXTimeTZ.h; sourceTree = "<group>"; };
1724CC9115FB4CC200AB2291 /* FLXTimeTZ.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FLXTimeTZ.m; sourceTree = "<group>"; };
+ 1724CD0415FB68E800AB2291 /* Tests.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Tests.octest; sourceTree = BUILT_PRODUCTS_DIR; };
+ 1724CD0515FB68E800AB2291 /* Tests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "Tests-Info.plist"; path = "Resources/Tests-Info.plist"; sourceTree = "<group>"; };
1731F02915EE09E000D973EB /* FLXPostgresConnectionParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FLXPostgresConnectionParameters.h; sourceTree = "<group>"; };
1731F02A15EE09E000D973EB /* FLXPostgresConnectionParameters.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FLXPostgresConnectionParameters.m; sourceTree = "<group>"; };
1731F10615F1A52B00D973EB /* FLXPostgresTypeDateTimeHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FLXPostgresTypeDateTimeHandler.h; sourceTree = "<group>"; };
@@ -103,11 +117,20 @@
177C9BAA15CD37E000128642 /* FLXPostgresConnectionEncoding.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FLXPostgresConnectionEncoding.m; sourceTree = "<group>"; };
17E595F114F3058F0054EE08 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
17F5B77C15C9D092006DA689 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
- 8DC2EF5A0486A6940098B216 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = ../Resources/Info.plist; sourceTree = "<group>"; };
+ 8DC2EF5A0486A6940098B216 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = Resources/Info.plist; sourceTree = "<group>"; };
8DC2EF5B0486A6940098B216 /* PostgresKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = PostgresKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
+ 1724CD0115FB68E800AB2291 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 1724CD1515FB69EC00AB2291 /* Foundation.framework in Frameworks */,
+ 1724CD1815FB6A0500AB2291 /* PostgresKit.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
8DC2EF560486A6940098B216 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
@@ -127,6 +150,7 @@
isa = PBXGroup;
children = (
8DC2EF5B0486A6940098B216 /* PostgresKit.framework */,
+ 1724CD0415FB68E800AB2291 /* Tests.octest */,
);
name = Products;
sourceTree = "<group>";
@@ -157,6 +181,8 @@
089C1665FE841158C02AAC07 /* Resources */ = {
isa = PBXGroup;
children = (
+ 8DC2EF5A0486A6940098B216 /* Info.plist */,
+ 1724CD0515FB68E800AB2291 /* Tests-Info.plist */,
173D4EDE15BACA090007F267 /* Libs */,
);
name = Resources;
@@ -279,7 +305,6 @@
173D4EDE15BACA090007F267 /* Libs */ = {
isa = PBXGroup;
children = (
- 8DC2EF5A0486A6940098B216 /* Info.plist */,
1724CA3715F9EDC900AB2291 /* libpq */,
1724CA3815F9EE1100AB2291 /* libpqtypes */,
);
@@ -376,6 +401,24 @@
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
+ 1724CD0315FB68E800AB2291 /* Tests */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 1724CD0915FB68E900AB2291 /* Build configuration list for PBXNativeTarget "Tests" */;
+ buildPhases = (
+ 1724CD0015FB68E800AB2291 /* Sources */,
+ 1724CD0115FB68E800AB2291 /* Frameworks */,
+ 1724CD0215FB68E800AB2291 /* ShellScript */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ 1724CD1715FB69EF00AB2291 /* PBXTargetDependency */,
+ );
+ name = Tests;
+ productName = Tests;
+ productReference = 1724CD0415FB68E800AB2291 /* Tests.octest */;
+ productType = "com.apple.product-type.bundle";
+ };
8DC2EF4F0486A6940098B216 /* PostgresKit */ = {
isa = PBXNativeTarget;
buildConfigurationList = 1DEB91AD08733DA50010E9CD /* Build configuration list for PBXNativeTarget "PostgresKit" */;
@@ -415,11 +458,35 @@
projectRoot = "";
targets = (
8DC2EF4F0486A6940098B216 /* PostgresKit */,
+ 1724CD0315FB68E800AB2291 /* Tests */,
);
};
/* End PBXProject section */
+/* Begin PBXShellScriptBuildPhase section */
+ 1724CD0215FB68E800AB2291 /* ShellScript */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ );
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "\"${SRCROOT}/Scripts/run-tests.sh\"\n";
+ };
+/* End PBXShellScriptBuildPhase section */
+
/* Begin PBXSourcesBuildPhase section */
+ 1724CD0015FB68E800AB2291 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
8DC2EF540486A6940098B216 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
@@ -446,7 +513,93 @@
};
/* End PBXSourcesBuildPhase section */
+/* Begin PBXTargetDependency section */
+ 1724CD1715FB69EF00AB2291 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 8DC2EF4F0486A6940098B216 /* PostgresKit */;
+ targetProxy = 1724CD1615FB69EF00AB2291 /* PBXContainerItemProxy */;
+ };
+/* End PBXTargetDependency section */
+
/* Begin XCBuildConfiguration section */
+ 1724CD0615FB68E800AB2291 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = NO;
+ FRAMEWORK_SEARCH_PATHS = "$(DEVELOPER_LIBRARY_DIR)/Frameworks";
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_ENABLE_FIX_AND_CONTINUE = NO;
+ GCC_ENABLE_OBJC_EXCEPTIONS = YES;
+ GCC_MODEL_TUNING = G5;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Cocoa.framework/Headers/Cocoa.h";
+ INFOPLIST_FILE = "Resources/Tests-Info.plist";
+ INSTALL_PATH = "$(USER_LIBRARY_DIR)/Bundles";
+ OTHER_LDFLAGS = (
+ "-framework",
+ Cocoa,
+ "-framework",
+ SenTestingKit,
+ );
+ PREBINDING = NO;
+ PRODUCT_NAME = Tests;
+ WRAPPER_EXTENSION = octest;
+ };
+ name = Debug;
+ };
+ 1724CD0715FB68E800AB2291 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = YES;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ FRAMEWORK_SEARCH_PATHS = "$(DEVELOPER_LIBRARY_DIR)/Frameworks";
+ GCC_ENABLE_FIX_AND_CONTINUE = NO;
+ GCC_ENABLE_OBJC_EXCEPTIONS = YES;
+ GCC_MODEL_TUNING = G5;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Cocoa.framework/Headers/Cocoa.h";
+ INFOPLIST_FILE = "Resources/Tests-Info.plist";
+ INSTALL_PATH = "$(USER_LIBRARY_DIR)/Bundles";
+ OTHER_LDFLAGS = (
+ "-framework",
+ Cocoa,
+ "-framework",
+ SenTestingKit,
+ );
+ PREBINDING = NO;
+ PRODUCT_NAME = Tests;
+ WRAPPER_EXTENSION = octest;
+ ZERO_LINK = NO;
+ };
+ name = Release;
+ };
+ 1724CD0815FB68E800AB2291 /* Distribution */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ FRAMEWORK_SEARCH_PATHS = "$(DEVELOPER_LIBRARY_DIR)/Frameworks";
+ GCC_ENABLE_FIX_AND_CONTINUE = NO;
+ GCC_ENABLE_OBJC_EXCEPTIONS = YES;
+ GCC_MODEL_TUNING = G5;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Cocoa.framework/Headers/Cocoa.h";
+ INFOPLIST_FILE = "Resources/Tests-Info.plist";
+ INSTALL_PATH = "$(USER_LIBRARY_DIR)/Bundles";
+ OTHER_LDFLAGS = (
+ "-framework",
+ Cocoa,
+ "-framework",
+ SenTestingKit,
+ );
+ PREBINDING = NO;
+ PRODUCT_NAME = Tests;
+ WRAPPER_EXTENSION = octest;
+ };
+ name = Distribution;
+ };
17E5952D14F302740054EE08 /* Distribution */ = {
isa = XCBuildConfiguration;
buildSettings = {
@@ -659,6 +812,16 @@
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
+ 1724CD0915FB68E900AB2291 /* Build configuration list for PBXNativeTarget "Tests" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 1724CD0615FB68E800AB2291 /* Debug */,
+ 1724CD0715FB68E800AB2291 /* Release */,
+ 1724CD0815FB68E800AB2291 /* Distribution */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
1DEB91AD08733DA50010E9CD /* Build configuration list for PBXNativeTarget "PostgresKit" */ = {
isa = XCConfigurationList;
buildConfigurations = (
diff --git a/Frameworks/PostgresKit/Resources/TestData.sql b/Frameworks/PostgresKit/Resources/TestData.sql
index 1aea4908..036ce4f2 100644
--- a/Frameworks/PostgresKit/Resources/TestData.sql
+++ b/Frameworks/PostgresKit/Resources/TestData.sql
@@ -41,7 +41,7 @@ INSERT INTO data_types (
timetz_field,
timstamp_field,
timestamptz_field)
-VALUES (
+SELECT
12345,
2,
TRUE,
@@ -52,7 +52,8 @@ VALUES (
'02:02:02',
'02:02:02 GMT',
'08-04-1987 02:02:02',
- '08-04-1987 02:02:02 GMT');
+ '08-04-1987 02:02:02 GMT'
+WHERE NOT EXISTS (SELECT 1 FROM data_types WHERE int_field = 12345);
COMMIT;
diff --git a/Frameworks/PostgresKit/Resources/Tests-Info.plist b/Frameworks/PostgresKit/Resources/Tests-Info.plist
new file mode 100644
index 00000000..38648be0
--- /dev/null
+++ b/Frameworks/PostgresKit/Resources/Tests-Info.plist
@@ -0,0 +1,22 @@
+<?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>English</string>
+ <key>CFBundleExecutable</key>
+ <string>PostgresKit</string>
+ <key>CFBundleIdentifier</key>
+ <string>com.google.code.sequel-pro.postgreskit.tests</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>
diff --git a/Frameworks/PostgresKit/Scripts/build-libpq.sh b/Frameworks/PostgresKit/Scripts/build-libpq.sh
index a4f07f18..e94308e9 100755
--- a/Frameworks/PostgresKit/Scripts/build-libpq.sh
+++ b/Frameworks/PostgresKit/Scripts/build-libpq.sh
@@ -3,7 +3,7 @@
#
# $Id$
#
-# build-
+# build-libpq.sh
# sequel-pro
#
# Created by Stuart Connolly (stuconnolly.com) on August 1, 2012.
diff --git a/Frameworks/PostgresKit/Scripts/run-tests.sh b/Frameworks/PostgresKit/Scripts/run-tests.sh
new file mode 100755
index 00000000..73e8292f
--- /dev/null
+++ b/Frameworks/PostgresKit/Scripts/run-tests.sh
@@ -0,0 +1,65 @@
+#! /bin/ksh
+
+#
+# $Id$
+#
+# run-tests.sh
+# sequel-pro
+#
+# Created by Stuart Connolly (stuconnolly.com) on September 9, 2012.
+# Copyright (c) 2012 Stuart Connolly. All rights reserved.
+#
+# Permission is hereby granted, free of charge, to any person
+# obtaining a copy of this software and associated documentation
+# files (the "Software"), to deal in the Software without
+# restriction, including without limitation the rights to use,
+# copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following
+# conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+# OTHER DEALINGS IN THE SOFTWARE.
+#
+# More info at <http://code.google.com/p/sequel-pro/>
+
+export PGPASSWORD=pgkit
+
+if [ ! -f /Library/PostgreSQL/bin/psql ]
+then
+ echo "error: can't find Postgres CLI at path '/Library/PostgreSQL/bin/psql'. No tests will be run."
+ exit 1
+fi
+
+TEST_DATA_FILE="${SRCROOT}/Resources/TestData.sql"
+
+if [ ! -f "$TEST_DATA_FILE" ]
+then
+ echo "error: Test data file does not exist at path '${TEST_DATA_FILE}'. No tests will be run."
+ exit 1
+fi
+
+echo 'Loading integration data...'
+
+/Library/PostgreSQL/bin/psql -U pgkit_test -d pgkit_test -q < "$TEST_DATA_FILE" > /dev/null 2>&1
+
+if [ $? -eq 0 ]
+then
+ echo 'Integration test data successfully loaded. Running tests..'
+else
+ echo 'error: Failed to load integration data. No tests will be run.'
+ exit 1
+fi
+
+"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests"
+
+exit 0