mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-26 04:57:54 +00:00
Finally added unit tests.
For now, covering only version comparison. Actually found and fixed a bug that made 1.0b1 < 1.0a1 Feel free to add more tests.
This commit is contained in:
1 parent
49e3d819bf
commit
db443909ed
4 files changed
+226
-1
No files matched your search
@@ -98,7 +98,7 @@ typedef enum {
|
||||
return NSOrderedAscending;
|
||||
}
|
||||
} else if (typeA == kStringType) {
|
||||
NSComparisonResult result = [partB compare:partA];
|
||||
NSComparisonResult result = [partA compare:partB];
|
||||
if (result != NSOrderedSame) {
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
61180BCB0D64138900B4E0D1 /* SUWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 61180BC90D64138900B4E0D1 /* SUWindowController.m */; };
|
||||
6120721209CC5C4B007FE0F6 /* SUAutomaticUpdateAlert.h in Headers */ = {isa = PBXBuildFile; fileRef = 6120721009CC5C4B007FE0F6 /* SUAutomaticUpdateAlert.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
6120721309CC5C4B007FE0F6 /* SUAutomaticUpdateAlert.m in Sources */ = {isa = PBXBuildFile; fileRef = 6120721109CC5C4B007FE0F6 /* SUAutomaticUpdateAlert.m */; };
|
||||
61227A080DB5480900AB99EA /* Sparkle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8DC2EF5B0486A6940098B216 /* Sparkle.framework */; };
|
||||
61227A160DB548B800AB99EA /* SUVersionComparisonTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 61227A150DB548B800AB99EA /* SUVersionComparisonTest.m */; };
|
||||
61299A2F09CA2DAB00B7442F /* NSFileManager+Verification.h in Headers */ = {isa = PBXBuildFile; fileRef = 61299A2D09CA2DAB00B7442F /* NSFileManager+Verification.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
61299A3009CA2DAB00B7442F /* NSFileManager+Verification.m in Sources */ = {isa = PBXBuildFile; fileRef = 61299A2E09CA2DAB00B7442F /* NSFileManager+Verification.m */; };
|
||||
61299A4A09CA2DD000B7442F /* NSFileManager+Authentication.h in Headers */ = {isa = PBXBuildFile; fileRef = 6129984309C9E2DA00B7442F /* NSFileManager+Authentication.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
@@ -87,6 +89,20 @@
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
612279ED0DB547FE00AB99EA /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 8DC2EF4F0486A6940098B216;
|
||||
remoteInfo = Sparkle;
|
||||
};
|
||||
61227AB90DB5C4BB00AB99EA /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 612279D80DB5470200AB99EA /* Sparkle Unit Tests */;
|
||||
remoteInfo = "Sparkle Unit Tests";
|
||||
};
|
||||
61B5F91B09C4CF7200B25A18 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
|
||||
@@ -141,6 +157,10 @@
|
||||
61180BC90D64138900B4E0D1 /* SUWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUWindowController.m; sourceTree = "<group>"; };
|
||||
6120721009CC5C4B007FE0F6 /* SUAutomaticUpdateAlert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUAutomaticUpdateAlert.h; sourceTree = "<group>"; };
|
||||
6120721109CC5C4B007FE0F6 /* SUAutomaticUpdateAlert.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUAutomaticUpdateAlert.m; sourceTree = "<group>"; };
|
||||
612279D90DB5470200AB99EA /* Sparkle Unit Tests.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Sparkle Unit Tests.octest"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
612279DA0DB5470200AB99EA /* Sparkle Unit Tests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Sparkle Unit Tests-Info.plist"; sourceTree = "<group>"; };
|
||||
61227A140DB548B800AB99EA /* SUVersionComparisonTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SUVersionComparisonTest.h; path = Tests/SUVersionComparisonTest.h; sourceTree = "<group>"; };
|
||||
61227A150DB548B800AB99EA /* SUVersionComparisonTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SUVersionComparisonTest.m; path = Tests/SUVersionComparisonTest.m; sourceTree = "<group>"; };
|
||||
6129984309C9E2DA00B7442F /* NSFileManager+Authentication.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSFileManager+Authentication.h"; sourceTree = "<group>"; };
|
||||
61299A2D09CA2DAB00B7442F /* NSFileManager+Verification.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSFileManager+Verification.h"; sourceTree = "<group>"; };
|
||||
61299A2E09CA2DAB00B7442F /* NSFileManager+Verification.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSFileManager+Verification.m"; sourceTree = "<group>"; };
|
||||
@@ -292,6 +312,14 @@
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
612279D60DB5470200AB99EA /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
61227A080DB5480900AB99EA /* Sparkle.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
61B5F90009C4CEE200B25A18 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@@ -332,6 +360,7 @@
|
||||
8DC2EF5B0486A6940098B216 /* Sparkle.framework */,
|
||||
61B5F90209C4CEE200B25A18 /* Sparkle Test App.app */,
|
||||
DAAEFC960DA571DF0051E0D0 /* relaunch */,
|
||||
612279D90DB5470200AB99EA /* Sparkle Unit Tests.octest */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
@@ -340,12 +369,14 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
08FB77AEFE84172EC02AAC07 /* Sparkle Classes */,
|
||||
61227A100DB5484000AB99EA /* Tests */,
|
||||
61B5F91D09C4CF7F00B25A18 /* Test Application Sources */,
|
||||
32C88DFF0371C24200C91783 /* Other Sources */,
|
||||
089C1665FE841158C02AAC07 /* Resources */,
|
||||
FA1941C40D94A6EA00DD942E /* Configurations */,
|
||||
0867D69AFE84028FC02AAC07 /* Apple Frameworks and Libraries */,
|
||||
034768DFFF38A50411DB9C8B /* Products */,
|
||||
612279DA0DB5470200AB99EA /* Sparkle Unit Tests-Info.plist */,
|
||||
);
|
||||
name = Sparkle;
|
||||
sourceTree = "<group>";
|
||||
@@ -403,6 +434,15 @@
|
||||
name = "Other Sources";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
61227A100DB5484000AB99EA /* Tests */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
61227A140DB548B800AB99EA /* SUVersionComparisonTest.h */,
|
||||
61227A150DB548B800AB99EA /* SUVersionComparisonTest.m */,
|
||||
);
|
||||
name = Tests;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
61299B3809CB053D00B7442F /* Cocoa Categories */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -558,6 +598,25 @@
|
||||
/* End PBXHeadersBuildPhase section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
612279D80DB5470200AB99EA /* Sparkle Unit Tests */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 612279DD0DB5470300AB99EA /* Build configuration list for PBXNativeTarget "Sparkle Unit Tests" */;
|
||||
buildPhases = (
|
||||
612279D40DB5470200AB99EA /* Resources */,
|
||||
612279D50DB5470200AB99EA /* Sources */,
|
||||
612279D60DB5470200AB99EA /* Frameworks */,
|
||||
612279D70DB5470200AB99EA /* ShellScript */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
612279EE0DB547FE00AB99EA /* PBXTargetDependency */,
|
||||
);
|
||||
name = "Sparkle Unit Tests";
|
||||
productName = "Sparkle Unit Tests";
|
||||
productReference = 612279D90DB5470200AB99EA /* Sparkle Unit Tests.octest */;
|
||||
productType = "com.apple.product-type.bundle";
|
||||
};
|
||||
61B5F90109C4CEE200B25A18 /* Sparkle Test App */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 61B5F90509C4CEE300B25A18 /* Build configuration list for PBXNativeTarget "Sparkle Test App" */;
|
||||
@@ -571,6 +630,7 @@
|
||||
);
|
||||
dependencies = (
|
||||
61B5F91C09C4CF7200B25A18 /* PBXTargetDependency */,
|
||||
61227ABA0DB5C4BB00AB99EA /* PBXTargetDependency */,
|
||||
);
|
||||
name = "Sparkle Test App";
|
||||
productName = "Test Application";
|
||||
@@ -663,11 +723,19 @@
|
||||
8DC2EF4F0486A6940098B216 /* Sparkle */,
|
||||
61B5F90109C4CEE200B25A18 /* Sparkle Test App */,
|
||||
DAAEFC950DA571DF0051E0D0 /* relaunch tool */,
|
||||
612279D80DB5470200AB99EA /* Sparkle Unit Tests */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
612279D40DB5470200AB99EA /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
61B5F8FE09C4CEE200B25A18 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@@ -693,7 +761,31 @@
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
612279D70DB5470200AB99EA /* ShellScript */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "# Run the unit tests in this test bundle.\n\"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests\"\n";
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
612279D50DB5470200AB99EA /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
61227A160DB548B800AB99EA /* SUVersionComparisonTest.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
61B5F8FF09C4CEE200B25A18 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@@ -746,6 +838,16 @@
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
612279EE0DB547FE00AB99EA /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 8DC2EF4F0486A6940098B216 /* Sparkle */;
|
||||
targetProxy = 612279ED0DB547FE00AB99EA /* PBXContainerItemProxy */;
|
||||
};
|
||||
61227ABA0DB5C4BB00AB99EA /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 612279D80DB5470200AB99EA /* Sparkle Unit Tests */;
|
||||
targetProxy = 61227AB90DB5C4BB00AB99EA /* PBXContainerItemProxy */;
|
||||
};
|
||||
61B5F91C09C4CF7200B25A18 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 8DC2EF4F0486A6940098B216 /* Sparkle */;
|
||||
@@ -911,6 +1013,62 @@
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
612279DB0DB5470300AB99EA /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
ARCHS = "$(NATIVE_ARCH)";
|
||||
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 = "Sparkle Unit Tests-Info.plist";
|
||||
INSTALL_PATH = "$(USER_LIBRARY_DIR)/Bundles";
|
||||
OTHER_LDFLAGS = (
|
||||
"-framework",
|
||||
Cocoa,
|
||||
"-framework",
|
||||
SenTestingKit,
|
||||
);
|
||||
PREBINDING = NO;
|
||||
PRODUCT_NAME = "Sparkle Unit Tests";
|
||||
WRAPPER_EXTENSION = octest;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
612279DC0DB5470300AB99EA /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
ARCHS = "$(NATIVE_ARCH)";
|
||||
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 = "Sparkle Unit Tests-Info.plist";
|
||||
INSTALL_PATH = "$(USER_LIBRARY_DIR)/Bundles";
|
||||
OTHER_LDFLAGS = (
|
||||
"-framework",
|
||||
Cocoa,
|
||||
"-framework",
|
||||
SenTestingKit,
|
||||
);
|
||||
PREBINDING = NO;
|
||||
PRODUCT_NAME = "Sparkle Unit Tests";
|
||||
WRAPPER_EXTENSION = octest;
|
||||
ZERO_LINK = NO;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
61B5F90609C4CEE300B25A18 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = FA1941CB0D94A70100DD942E /* ConfigTestAppDebug.xcconfig */;
|
||||
@@ -960,6 +1118,15 @@
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
612279DD0DB5470300AB99EA /* Build configuration list for PBXNativeTarget "Sparkle Unit Tests" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
612279DB0DB5470300AB99EA /* Debug */,
|
||||
612279DC0DB5470300AB99EA /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
61B5F90509C4CEE300B25A18 /* Build configuration list for PBXNativeTarget "Sparkle Test App" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// SUVersionComparisonTest.h
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Andy Matuschak on 4/15/08.
|
||||
// Copyright 2008 Andy Matuschak. All rights reserved.
|
||||
//
|
||||
|
||||
#import <SenTestingKit/SenTestingKit.h>
|
||||
|
||||
|
||||
@interface SUVersionComparisonTest : SenTestCase {
|
||||
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,42 @@
|
||||
//
|
||||
// SUVersionComparisonTest.m
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Andy Matuschak on 4/15/08.
|
||||
// Copyright 2008 Andy Matuschak. All rights reserved.
|
||||
//
|
||||
|
||||
#import "SUVersionComparisonTest.h"
|
||||
#import "Sparkle.h"
|
||||
|
||||
@implementation SUVersionComparisonTest
|
||||
|
||||
#define SUAssertOrder(a,b,c) STAssertTrue([[SUStandardVersionComparator defaultComparator] compareVersion:a toVersion:b] == c, @"b should be newer than a!")
|
||||
#define SUAssertAscending(a, b) SUAssertOrder(a,b,NSOrderedAscending)
|
||||
#define SUAssertDescending(a, b) SUAssertOrder(a,b,NSOrderedDescending)
|
||||
#define SUAssertEqual(a, b) SUAssertOrder(a,b,NSOrderedSame)
|
||||
|
||||
- (void)testNumbers
|
||||
{
|
||||
SUAssertAscending(@"1.0", @"1.1");
|
||||
SUAssertEqual(@"1.0", @"1.0");
|
||||
SUAssertDescending(@"2.0", @"1.1");
|
||||
SUAssertDescending(@"0.1", @"0.0.1");
|
||||
//SUAssertDescending(@".1", @"0.0.1"); Known bug, but I'm not sure I care.
|
||||
SUAssertAscending(@"0.1", @"0.1.2");
|
||||
}
|
||||
|
||||
- (void)testPrereleases
|
||||
{
|
||||
SUAssertAscending(@"1.0a1", @"1.0b1");
|
||||
SUAssertAscending(@"1.0b1", @"1.0");
|
||||
SUAssertAscending(@"0.9", @"1.0a1");
|
||||
SUAssertAscending(@"1.0b", @"1.0b2");
|
||||
SUAssertAscending(@"1.0rc", @"1.0");
|
||||
SUAssertAscending(@"1.0b", @"1.0");
|
||||
SUAssertAscending(@"1.0pre1", @"1.0");
|
||||
SUAssertAscending(@"1.0 beta", @"1.0");
|
||||
SUAssertAscending(@"1.0 alpha", @"1.0 beta");
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in new issue
Block a user