Skip to content

Instantly share code, notes, and snippets.

@brianmichel
Created February 4, 2022 22:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brianmichel/df992e18f4d4b69a151f08f5f98147d7 to your computer and use it in GitHub Desktop.
Save brianmichel/df992e18f4d4b69a151f08f5f98147d7 to your computer and use it in GitHub Desktop.
A patch for a new test to exercise the Appcast parsing behavior in Sparkle for my failing updater.
diff --git a/Tests/SUAppcastTest.swift b/Tests/SUAppcastTest.swift
index a1e921db..336e959b 100644
--- a/Tests/SUAppcastTest.swift
+++ b/Tests/SUAppcastTest.swift
@@ -11,6 +11,27 @@ import Sparkle
class SUAppcastTest: XCTestCase {
+ func testBrokenAppcast() {
+ let testURL = Bundle(for: SUAppcastTest.self).url(forResource: "marconio-broken-appcast", withExtension: "xml")!
+
+ do {
+ let testData = try Data(contentsOf: testURL)
+
+ let versionComparator = SUStandardVersionComparator.default
+ let hostVersion = "1.0"
+
+ let stateResolver = SPUAppcastItemStateResolver(hostVersion: hostVersion,
+ applicationVersionComparator: versionComparator,
+ standardVersionComparator: versionComparator)
+ let appcast = try SUAppcast(xmlData: testData, relativeTo: URL(string: "https://brianmichel.github.io/Marconio/appcast.xml")!, stateResolver: stateResolver)
+
+ XCTAssertNotNil(appcast)
+ } catch let err as NSError {
+ NSLog("%@", err)
+ XCTFail(err.localizedDescription)
+ }
+ }
+
func testParseAppcast() {
let testURL = Bundle(for: SUAppcastTest.self).url(forResource: "testappcast", withExtension: "xml")!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment