mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-25 04:47:55 +00:00
Fix tests that use SUStandardVersionComparator
This commit is contained in:
1 parent
e1a9e98d8b
commit
20e8ea8603
3 files changed
+5
-5
No files matched your search
@@ -40,20 +40,20 @@ class SUAppcastTest: XCTestCase {
|
||||
|
||||
// Test best appcast item & a delta update item
|
||||
var deltaItem: SUAppcastItem? = nil
|
||||
let bestAppcastItem = SUAppcastDriver.bestItemFromAppcastItems(items, getDeltaItem: &deltaItem, withHostVersion: "1.0", comparator: SUStandardVersionComparator.defaultComparator())
|
||||
let bestAppcastItem = SUAppcastDriver.bestItemFromAppcastItems(items, getDeltaItem: &deltaItem, withHostVersion: "1.0", comparator: SUStandardVersionComparator())
|
||||
|
||||
XCTAssertEqual(bestAppcastItem, items[1])
|
||||
XCTAssertEqual(deltaItem!.fileURL.lastPathComponent, "3.0_from_1.0.patch")
|
||||
|
||||
// Test latest delta update item available
|
||||
var latestDeltaItem: SUAppcastItem? = nil
|
||||
SUAppcastDriver.bestItemFromAppcastItems(items, getDeltaItem: &latestDeltaItem, withHostVersion: "2.0", comparator: SUStandardVersionComparator.defaultComparator())
|
||||
SUAppcastDriver.bestItemFromAppcastItems(items, getDeltaItem: &latestDeltaItem, withHostVersion: "2.0", comparator: SUStandardVersionComparator())
|
||||
|
||||
XCTAssertEqual(latestDeltaItem!.fileURL.lastPathComponent, "3.0_from_2.0.patch")
|
||||
|
||||
// Test a delta item that does not exist
|
||||
var nonexistantDeltaItem: SUAppcastItem? = nil
|
||||
SUAppcastDriver.bestItemFromAppcastItems(items, getDeltaItem: &nonexistantDeltaItem, withHostVersion: "2.1", comparator: SUStandardVersionComparator.defaultComparator())
|
||||
SUAppcastDriver.bestItemFromAppcastItems(items, getDeltaItem: &nonexistantDeltaItem, withHostVersion: "2.1", comparator: SUStandardVersionComparator())
|
||||
|
||||
XCTAssertNil(nonexistantDeltaItem)
|
||||
} catch let err as NSError {
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
SUHost *host = [[SUHost alloc] initWithBundle:bundle];
|
||||
|
||||
NSError *installerError = nil;
|
||||
id<SUInstaller> installer = [SUInstaller installerForHost:host updateDirectory:[path stringByDeletingLastPathComponent] versionComparator:[SUStandardVersionComparator defaultComparator] error:&installerError];
|
||||
id<SUInstaller> installer = [SUInstaller installerForHost:host updateDirectory:[path stringByDeletingLastPathComponent] versionComparator:[SUStandardVersionComparator standardVersionComparator] error:&installerError];
|
||||
|
||||
if (installer == nil) {
|
||||
XCTFail(@"Installer is nil with error: %@", installerError);
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
@implementation SUVersionComparisonTestCase
|
||||
|
||||
#define SUAssertOrder(a, b, c) XCTAssertTrue([[SUStandardVersionComparator defaultComparator] compareVersion:a toVersion:b] == c, @"b should be newer than a!")
|
||||
#define SUAssertOrder(a, b, c) XCTAssertTrue([[SUStandardVersionComparator standardVersionComparator] 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)
|
||||
|
||||
Reference in new issue
Block a user