aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2011-09-26 22:26:24 +0000
committerstuconnolly <stuart02@gmail.com>2011-09-26 22:26:24 +0000
commit915ea2f00e1f31a57e74e987062a1b5c2381635d (patch)
tree7f83258d94c31d649e42a5e64b3331fd1e4b8a43
parent5067d8cbc5db658330322f3291c8723a6b041473 (diff)
downloadsequelpro-915ea2f00e1f31a57e74e987062a1b5c2381635d.tar.gz
sequelpro-915ea2f00e1f31a57e74e987062a1b5c2381635d.tar.bz2
sequelpro-915ea2f00e1f31a57e74e987062a1b5c2381635d.zip
Fix test.
-rw-r--r--Frameworks/QueryKit/QueryKit.h1
-rw-r--r--Source/SPMenuAdditions.m4
-rw-r--r--UnitTests/QKSelectQueryTests.h2
-rw-r--r--UnitTests/QKSelectQueryTests.m34
-rw-r--r--sequel-pro.xcodeproj/project.pbxproj2
5 files changed, 26 insertions, 17 deletions
diff --git a/Frameworks/QueryKit/QueryKit.h b/Frameworks/QueryKit/QueryKit.h
index 89c8ef2f..04c072de 100644
--- a/Frameworks/QueryKit/QueryKit.h
+++ b/Frameworks/QueryKit/QueryKit.h
@@ -34,3 +34,4 @@
#import <QueryKit/QKQueryTypes.h>
#import <QueryKit/QKQueryOperators.h>
#import <QueryKit/QKQueryParameter.h>
+#import <QueryKit/QKQueryUtilities.h>
diff --git a/Source/SPMenuAdditions.m b/Source/SPMenuAdditions.m
index d653f71a..4ee5956f 100644
--- a/Source/SPMenuAdditions.m
+++ b/Source/SPMenuAdditions.m
@@ -24,7 +24,6 @@
#import "SPMenuAdditions.h"
-
@implementation NSMenu (SPMenuAdditions)
// Add a 10.5-compatible removeAllItems
@@ -32,7 +31,8 @@
{
if ([self respondsToSelector:@selector(removeAllItems)]) {
[(id)self removeAllItems];
- } else {
+ }
+ else {
while ([self numberOfItems]) [self removeItemAtIndex:0];
}
}
diff --git a/UnitTests/QKSelectQueryTests.h b/UnitTests/QKSelectQueryTests.h
index 85f4b17f..5a7bdafc 100644
--- a/UnitTests/QKSelectQueryTests.h
+++ b/UnitTests/QKSelectQueryTests.h
@@ -23,6 +23,8 @@
//
// More info at <http://code.google.com/p/sequel-pro/>
+#import <QueryKit/QueryKit.h>
+
#import <SenTestingKit/SenTestingKit.h>
@interface QKSelectQueryTests : SenTestCase
diff --git a/UnitTests/QKSelectQueryTests.m b/UnitTests/QKSelectQueryTests.m
index 98a67ab6..5d013987 100644
--- a/UnitTests/QKSelectQueryTests.m
+++ b/UnitTests/QKSelectQueryTests.m
@@ -23,17 +23,16 @@
//
// More info at <http://code.google.com/p/sequel-pro/>
-#import <QueryKit/QueryKit.h>
#import "QKSelectQueryTests.h"
-static NSString *SPTestTableName = @"test_table";
+static NSString *QKTestTableName = @"test_table";
-static NSString *SPTestFieldOne = @"test_field1";
-static NSString *SPTestFieldTwo = @"test_field2";
-static NSString *SPTestFieldThree = @"test_field3";
-static NSString *SPTestFieldFour = @"test_field4";
+static NSString *QKTestFieldOne = @"test_field1";
+static NSString *QKTestFieldTwo = @"test_field2";
+static NSString *QKTestFieldThree = @"test_field3";
+static NSString *QKTestFieldFour = @"test_field4";
-static NSString *SPTestParameterOne = @"10";
+static NSString *QKTestParameterOne = @"10";
@implementation QKSelectQueryTests
@@ -42,14 +41,14 @@ static NSString *SPTestParameterOne = @"10";
- (void)setUp
{
- _query = [QKQuery selectQueryFromTable:SPTestTableName];
+ _query = [QKQuery selectQueryFromTable:QKTestTableName];
- [_query addField:SPTestFieldOne];
- [_query addField:SPTestFieldTwo];
- [_query addField:SPTestFieldThree];
- [_query addField:SPTestFieldFour];
+ [_query addField:QKTestFieldOne];
+ [_query addField:QKTestFieldTwo];
+ [_query addField:QKTestFieldThree];
+ [_query addField:QKTestFieldFour];
- [_query addParameter:SPTestFieldOne operator:QKEqualityOperator value:SPTestParameterOne];
+ [_query addParameter:QKTestFieldOne operator:QKEqualityOperator value:QKTestParameterOne];
}
#pragma mark -
@@ -62,9 +61,16 @@ static NSString *SPTestParameterOne = @"10";
- (void)testSelectQueryFieldsAreCorrect
{
- NSString *query = [NSString stringWithFormat:@"SELECT %@, %@, %@, %@", SPTestFieldOne, SPTestFieldTwo, SPTestFieldThree, SPTestFieldFour];
+ NSString *query = [NSString stringWithFormat:@"SELECT %@, %@, %@, %@", QKTestFieldOne, QKTestFieldTwo, QKTestFieldThree, QKTestFieldFour];
STAssertTrue([[_query query] hasPrefix:query], @"query fields");
}
+- (void)testSelectQueryConstraintsAreCorrect
+{
+ NSString *query = [NSString stringWithFormat:@"WHERE %@ %@ %@", QKTestFieldOne, [QKQueryUtilities operatorRepresentationForType:QKEqualityOperator], QKTestParameterOne];
+
+ STAssertTrue(([[_query query] rangeOfString:query].location != NSNotFound), @"query constraints");
+}
+
@end
diff --git a/sequel-pro.xcodeproj/project.pbxproj b/sequel-pro.xcodeproj/project.pbxproj
index 899a5100..761c9e40 100644
--- a/sequel-pro.xcodeproj/project.pbxproj
+++ b/sequel-pro.xcodeproj/project.pbxproj
@@ -186,7 +186,7 @@
17FC35CA1413D14A00AC3602 /* QueryKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 17FC35911413CF7200AC3602 /* QueryKit.h */; settings = {ATTRIBUTES = (Public, ); }; };
17FC360B1413DAED00AC3602 /* QKQueryParameter.h in Headers */ = {isa = PBXBuildFile; fileRef = 17FC36091413DAED00AC3602 /* QKQueryParameter.h */; settings = {ATTRIBUTES = (Public, ); }; };
17FC360C1413DAED00AC3602 /* QKQueryParameter.m in Sources */ = {isa = PBXBuildFile; fileRef = 17FC360A1413DAED00AC3602 /* QKQueryParameter.m */; };
- 17FC3626141411B800AC3602 /* QKQueryUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 17FC3624141411B800AC3602 /* QKQueryUtilities.h */; };
+ 17FC3626141411B800AC3602 /* QKQueryUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 17FC3624141411B800AC3602 /* QKQueryUtilities.h */; settings = {ATTRIBUTES = (Public, ); }; };
17FC3627141411B800AC3602 /* QKQueryUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 17FC3625141411B800AC3602 /* QKQueryUtilities.m */; };
17FC3634141415F100AC3602 /* QKSelectQueryTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 17FC3633141415F100AC3602 /* QKSelectQueryTests.m */; };
17FDB04C1280778B00DBBBC2 /* SPFontPreviewTextField.m in Sources */ = {isa = PBXBuildFile; fileRef = 17FDB04B1280778B00DBBBC2 /* SPFontPreviewTextField.m */; };