diff options
author | stuconnolly <stuart02@gmail.com> | 2011-09-26 22:26:24 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2011-09-26 22:26:24 +0000 |
commit | 915ea2f00e1f31a57e74e987062a1b5c2381635d (patch) | |
tree | 7f83258d94c31d649e42a5e64b3331fd1e4b8a43 /UnitTests | |
parent | 5067d8cbc5db658330322f3291c8723a6b041473 (diff) | |
download | sequelpro-915ea2f00e1f31a57e74e987062a1b5c2381635d.tar.gz sequelpro-915ea2f00e1f31a57e74e987062a1b5c2381635d.tar.bz2 sequelpro-915ea2f00e1f31a57e74e987062a1b5c2381635d.zip |
Fix test.
Diffstat (limited to 'UnitTests')
-rw-r--r-- | UnitTests/QKSelectQueryTests.h | 2 | ||||
-rw-r--r-- | UnitTests/QKSelectQueryTests.m | 34 |
2 files changed, 22 insertions, 14 deletions
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 |