From 29434c98f83f902a5a483cb2aedc380ad3e90bd9 Mon Sep 17 00:00:00 2001 From: stuconnolly Date: Fri, 13 Nov 2009 23:43:46 +0000 Subject: Rename test case classes. --- UnitTests/MCPKitTest.h | 35 ++++++++++++++ UnitTests/MCPKitTest.m | 85 +++++++++++++++++++++++++++++++++ UnitTests/SPStringAdditionsTest.h | 30 ++++++++++++ UnitTests/SPStringAdditionsTest.m | 57 ++++++++++++++++++++++ UnitTests/mcpKitTest.h | 33 ------------- UnitTests/mcpKitTest.m | 83 -------------------------------- UnitTests/stringCategoryAdditionsTest.h | 28 ----------- UnitTests/stringCategoryAdditionsTest.m | 55 --------------------- sequel-pro.xcodeproj/project.pbxproj | 29 +++++------ 9 files changed, 222 insertions(+), 213 deletions(-) create mode 100644 UnitTests/MCPKitTest.h create mode 100644 UnitTests/MCPKitTest.m create mode 100644 UnitTests/SPStringAdditionsTest.h create mode 100644 UnitTests/SPStringAdditionsTest.m delete mode 100644 UnitTests/mcpKitTest.h delete mode 100644 UnitTests/mcpKitTest.m delete mode 100644 UnitTests/stringCategoryAdditionsTest.h delete mode 100644 UnitTests/stringCategoryAdditionsTest.m diff --git a/UnitTests/MCPKitTest.h b/UnitTests/MCPKitTest.h new file mode 100644 index 00000000..d4d1ffec --- /dev/null +++ b/UnitTests/MCPKitTest.h @@ -0,0 +1,35 @@ +// +// $Id$ +// +// MCPKitTest.h +// sequel-pro +// +// Created by J Knight on 17/05/09. +// Copyright 2009 J Knight. All rights reserved. +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// More info at + +#import + +@class MCPConnection; + +@interface MCPKitTest : SenTestCase +{ + MCPConnection *connection; +} + +@end diff --git a/UnitTests/MCPKitTest.m b/UnitTests/MCPKitTest.m new file mode 100644 index 00000000..e347d9da --- /dev/null +++ b/UnitTests/MCPKitTest.m @@ -0,0 +1,85 @@ +// +// $Id$ +// +// MCPKitTest.m +// sequel-pro +// +// Created by J Knight on 17/05/09. +// Copyright 2009 J Knight. All rights reserved. +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// More info at + +#import + +#import "MCPKitTest.h" + +@implementation MCPKitTest + +- (void)setUp +{ + // For now, we try an find the following database in the local connection. + // If the connection fails for any reasons, tests are not run. + // http://downloads.mysql.com/docs/sakila-db.zip + // + // Set up a user called 'sakila' with no password that has all privs on the + // database 'sakila'. + + connection = [[MCPConnection alloc] initToSocket:@"/var/mysql/mysql.sock" withLogin:@"sakila"]; + + // Set the 'sakila' user's password + [connection setPassword:@""]; + + if (![connection isConnected]) { + [connection dealloc]; + connection = nil; + STFail(@"Error connecting to database server. No tests were run."); + } + else { + if (![connection selectDB:@"sakila"]) { + [connection dealloc]; + connection = nil; + STFail(@"Error selecting database 'sakila'. No tests were run."); + } + } +} + +- (void)tearDown +{ + if (connection != nil) { + [connection disconnect]; + [connection dealloc]; + } +} + +- (void)testServerVersion +{ + if (connection == nil) return; + + STAssertTrue([connection serverMajorVersion] != 0, @"server version"); + STAssertTrue([connection serverMajorVersion] != 0, @"server version"); +} + +- (void)testTableList +{ + if (connection == nil) return; + + MCPResult *queryResult = [connection queryString:@"SELECT * FROM actor"]; + + STAssertEquals([queryResult numOfRows], (my_ulonglong)200, @"actors table count"); +} + +@end diff --git a/UnitTests/SPStringAdditionsTest.h b/UnitTests/SPStringAdditionsTest.h new file mode 100644 index 00000000..66570b35 --- /dev/null +++ b/UnitTests/SPStringAdditionsTest.h @@ -0,0 +1,30 @@ +// +// $Id$ +// +// SPStringAdditionsTest.h +// sequel-pro +// +// Created by J Knight on 17/05/09. +// Copyright 2009 J Knight. All rights reserved. +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// More info at + +#import + +@interface SPStringAdditionsTest : SenTestCase + +@end diff --git a/UnitTests/SPStringAdditionsTest.m b/UnitTests/SPStringAdditionsTest.m new file mode 100644 index 00000000..208381a8 --- /dev/null +++ b/UnitTests/SPStringAdditionsTest.m @@ -0,0 +1,57 @@ +// +// $Id$ +// +// SPStringAdditionsTest.m +// sequel-pro +// +// Created by J Knight on 17/05/09. +// Copyright 2009 J Knight. All rights reserved. +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// More info at + +#import "SPStringAdditionsTest.h" +#import "SPStringAdditions.h" + +@implementation SPStringAdditionsTest + +- (void)setUp +{ + +} + +- (void)tearDown +{ + +} + +- (void)testStringByRemovingCharactersInSet +{ + NSCharacterSet *junk = [NSCharacterSet characterSetWithCharactersInString:@"abc',ü"]; + + NSString *s = @"this is big, crazy st'ring"; + NSString *expect = @"this is ig rzy string"; + + STAssertEqualObjects([s stringByRemovingCharactersInSet:junk], expect, @"stringByRemovingCharactersInSet"); + + // Check UTF + s = @"In der Kürze liegt die Würz"; + expect = @"In der Krze liegt die Wrz"; + + STAssertEqualObjects([s stringByRemovingCharactersInSet:junk], expect, @"stringByRemovingCharactersInSet"); +} + +@end diff --git a/UnitTests/mcpKitTest.h b/UnitTests/mcpKitTest.h deleted file mode 100644 index 14f263bd..00000000 --- a/UnitTests/mcpKitTest.h +++ /dev/null @@ -1,33 +0,0 @@ -// -// mcpKitTest.h -// sequel-pro -// -// Created by J Knight on 17/05/09. -// Copyright 2009 J Knight. All rights reserved. -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// More info at - -#import - -@class MCPConnection; - -@interface mcpKitTest : SenTestCase -{ - MCPConnection *connection; -} - -@end diff --git a/UnitTests/mcpKitTest.m b/UnitTests/mcpKitTest.m deleted file mode 100644 index 49c02eb8..00000000 --- a/UnitTests/mcpKitTest.m +++ /dev/null @@ -1,83 +0,0 @@ -// -// mcpKitTest.m -// sequel-pro -// -// Created by J Knight on 17/05/09. -// Copyright 2009 J Knight. All rights reserved. -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// More info at - -#import - -#import "mcpKitTest.h" - -@implementation mcpKitTest - -- (void)setUp -{ - // For now, we try an find the following database in the local connection. - // If the connection fails for any reasons, tests are not run. - // http://downloads.mysql.com/docs/sakila-db.zip - // - // Set up a user called 'sakila' with no password that has all privs on the - // database 'sakila'. - - connection = [[MCPConnection alloc] initToSocket:@"/var/mysql/mysql.sock" withLogin:@"sakila"]; - - // Set the 'sakila' user's password - [connection setPassword:@""]; - - if (![connection isConnected]) { - [connection dealloc]; - connection = nil; - STFail(@"Error connecting to database server. No tests were run."); - } - else { - if (![connection selectDB:@"sakila"]) { - [connection dealloc]; - connection = nil; - STFail(@"Error selecting database 'sakila'. No tests were run."); - } - } -} - -- (void)tearDown -{ - if (connection != nil) { - [connection disconnect]; - [connection dealloc]; - } -} - -- (void)testServerVersion -{ - if (connection == nil) return; - - STAssertTrue([connection serverMajorVersion] != 0, @"server version"); - STAssertTrue([connection serverMajorVersion] != 0, @"server version"); -} - -- (void)testTableList -{ - if (connection == nil) return; - - MCPResult *queryResult = [connection queryString:@"SELECT * FROM actor"]; - - STAssertEquals([queryResult numOfRows], (my_ulonglong)200, @"actors table count"); -} - -@end diff --git a/UnitTests/stringCategoryAdditionsTest.h b/UnitTests/stringCategoryAdditionsTest.h deleted file mode 100644 index d995a29e..00000000 --- a/UnitTests/stringCategoryAdditionsTest.h +++ /dev/null @@ -1,28 +0,0 @@ -// -// stringCategoryAdditionsTest.h -// sequel-pro -// -// Created by J Knight on 17/05/09. -// Copyright 2009 J Knight. All rights reserved. -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// More info at - -#import - -@interface stringCategoryAdditionsTest : SenTestCase - -@end diff --git a/UnitTests/stringCategoryAdditionsTest.m b/UnitTests/stringCategoryAdditionsTest.m deleted file mode 100644 index 11a4a49b..00000000 --- a/UnitTests/stringCategoryAdditionsTest.m +++ /dev/null @@ -1,55 +0,0 @@ -// -// stringCategoryAdditionsTest.m -// sequel-pro -// -// Created by J Knight on 17/05/09. -// Copyright 2009 J Knight. All rights reserved. -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// More info at - -#import "stringCategoryAdditionsTest.h" -#import "SPStringAdditions.h" - -@implementation stringCategoryAdditionsTest - -- (void)setUp -{ - -} - -- (void)tearDown -{ - -} - -- (void)testStringByRemovingCharactersInSet -{ - NSCharacterSet *junk = [NSCharacterSet characterSetWithCharactersInString:@"abc',ü"]; - - NSString *s = @"this is big, crazy st'ring"; - NSString *expect = @"this is ig rzy string"; - - STAssertEqualObjects([s stringByRemovingCharactersInSet:junk], expect, @"stringByRemovingCharactersInSet"); - - // Check UTF - s = @"In der Kürze liegt die Würz"; - expect = @"In der Krze liegt die Wrz"; - - STAssertEqualObjects([s stringByRemovingCharactersInSet:junk], expect, @"stringByRemovingCharactersInSet"); -} - -@end diff --git a/sequel-pro.xcodeproj/project.pbxproj b/sequel-pro.xcodeproj/project.pbxproj index 71c4a481..0ed458b5 100644 --- a/sequel-pro.xcodeproj/project.pbxproj +++ b/sequel-pro.xcodeproj/project.pbxproj @@ -127,8 +127,8 @@ 296DC8BC0F909194002A3258 /* MGTemplateStandardFilters.m in Sources */ = {isa = PBXBuildFile; fileRef = 296DC8B40F909194002A3258 /* MGTemplateStandardFilters.m */; }; 296DC8BF0F9091DF002A3258 /* libicucore.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 296DC8BE0F9091DF002A3258 /* libicucore.dylib */; }; 29A1B7E50FD1293A000B88E8 /* SPPrintAccessory.m in Sources */ = {isa = PBXBuildFile; fileRef = 29A1B7E40FD1293A000B88E8 /* SPPrintAccessory.m */; }; - 380F4EF50FC0B68F00B0BFD7 /* stringCategoryAdditionsTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 380F4EF40FC0B68F00B0BFD7 /* stringCategoryAdditionsTest.m */; }; - 380F4F250FC0C3D300B0BFD7 /* mcpKitTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 380F4F240FC0C3D300B0BFD7 /* mcpKitTest.m */; }; + 380F4EF50FC0B68F00B0BFD7 /* SPStringAdditionsTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 380F4EF40FC0B68F00B0BFD7 /* SPStringAdditionsTest.m */; }; + 380F4F250FC0C3D300B0BFD7 /* MCPKitTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 380F4F240FC0C3D300B0BFD7 /* MCPKitTest.m */; }; 384582BE0FB95C9100DDACB6 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 384582BC0FB95C9100DDACB6 /* Localizable.strings */; }; 384582C40FB95FF800DDACB6 /* func-small.png in Resources */ = {isa = PBXBuildFile; fileRef = 384582C30FB95FF800DDACB6 /* func-small.png */; }; 384582C70FB9603600DDACB6 /* proc-small.png in Resources */ = {isa = PBXBuildFile; fileRef = 384582C60FB9603600DDACB6 /* proc-small.png */; }; @@ -518,10 +518,10 @@ 2A37F4C4FDCFA73011CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; 2A37F4C5FDCFA73011CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; 380F4ED90FC0B50500B0BFD7 /* Unit Tests.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Unit Tests.octest"; sourceTree = BUILT_PRODUCTS_DIR; }; - 380F4EF30FC0B68F00B0BFD7 /* stringCategoryAdditionsTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = stringCategoryAdditionsTest.h; sourceTree = ""; }; - 380F4EF40FC0B68F00B0BFD7 /* stringCategoryAdditionsTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = stringCategoryAdditionsTest.m; sourceTree = ""; }; - 380F4F230FC0C3D300B0BFD7 /* mcpKitTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mcpKitTest.h; sourceTree = ""; }; - 380F4F240FC0C3D300B0BFD7 /* mcpKitTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = mcpKitTest.m; sourceTree = ""; }; + 380F4EF30FC0B68F00B0BFD7 /* SPStringAdditionsTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPStringAdditionsTest.h; sourceTree = ""; }; + 380F4EF40FC0B68F00B0BFD7 /* SPStringAdditionsTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPStringAdditionsTest.m; sourceTree = ""; }; + 380F4F230FC0C3D300B0BFD7 /* MCPKitTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MCPKitTest.h; sourceTree = ""; }; + 380F4F240FC0C3D300B0BFD7 /* MCPKitTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MCPKitTest.m; sourceTree = ""; }; 384582BD0FB95C9100DDACB6 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = Interfaces/English.lproj/Localizable.strings; sourceTree = SOURCE_ROOT; }; 384582C30FB95FF800DDACB6 /* func-small.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "func-small.png"; sourceTree = ""; }; 384582C60FB9603600DDACB6 /* proc-small.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "proc-small.png"; sourceTree = ""; }; @@ -1329,7 +1329,7 @@ isa = PBXGroup; children = ( 17E641420EF01E8A001BC333 /* Source */, - 380F4EF20FC0B67A00B0BFD7 /* UnitTests */, + 380F4EF20FC0B67A00B0BFD7 /* Unit Tests */, 17E642050EF020A3001BC333 /* Interfaces */, 17E641430EF01E90001BC333 /* Resources */, 1761FD9C0EF0486A00331368 /* Scripts */, @@ -1348,14 +1348,15 @@ name = Frameworks; sourceTree = ""; }; - 380F4EF20FC0B67A00B0BFD7 /* UnitTests */ = { + 380F4EF20FC0B67A00B0BFD7 /* Unit Tests */ = { isa = PBXGroup; children = ( - 380F4F230FC0C3D300B0BFD7 /* mcpKitTest.h */, - 380F4F240FC0C3D300B0BFD7 /* mcpKitTest.m */, - 380F4EF30FC0B68F00B0BFD7 /* stringCategoryAdditionsTest.h */, - 380F4EF40FC0B68F00B0BFD7 /* stringCategoryAdditionsTest.m */, + 380F4F230FC0C3D300B0BFD7 /* MCPKitTest.h */, + 380F4F240FC0C3D300B0BFD7 /* MCPKitTest.m */, + 380F4EF30FC0B68F00B0BFD7 /* SPStringAdditionsTest.h */, + 380F4EF40FC0B68F00B0BFD7 /* SPStringAdditionsTest.m */, ); + name = "Unit Tests"; path = UnitTests; sourceTree = ""; }; @@ -1750,8 +1751,8 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 380F4EF50FC0B68F00B0BFD7 /* stringCategoryAdditionsTest.m in Sources */, - 380F4F250FC0C3D300B0BFD7 /* mcpKitTest.m in Sources */, + 380F4EF50FC0B68F00B0BFD7 /* SPStringAdditionsTest.m in Sources */, + 380F4F250FC0C3D300B0BFD7 /* MCPKitTest.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; -- cgit v1.2.3