Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ permissions:
jobs:
build:
strategy:
fail-fast: false
matrix:
swift: ['swift-6.1', 'swift-6.2']
include:
Expand Down Expand Up @@ -45,27 +46,27 @@ jobs:
run: swift test --filter='AppcastTests' --parallel --xunit-output reports/AppcastTests.xml

- name: report unit test results
uses: dorny/test-reporter@afe6793191b75b608954023a46831a3fe10048d4
uses: dorny/test-reporter@fe45e9537387dac839af0d33ba56eed8e24189e8 # v2.3.0
if: always()
id: results-unit-tests
with:
name: 'results-unit-tests-${{ matrix.swift }}'
path: reports/AppcastTests.xml
reporter: java-junit
path: reports/AppcastTests-swift-testing.xml
Comment thread
jozefizso marked this conversation as resolved.
reporter: swift-xunit
fail-on-error: true

- name: run integration tests
continue-on-error: true
run: swift test --filter='IntegrationTests' --parallel --xunit-output reports/IntegrationTests.xml || true

- name: report integration test results
uses: dorny/test-reporter@afe6793191b75b608954023a46831a3fe10048d4
uses: dorny/test-reporter@fe45e9537387dac839af0d33ba56eed8e24189e8 # v2.3.0
if: always()
id: results-integration-tests
with:
name: 'results-integration-tests-${{ matrix.swift }}'
path: reports/IntegrationTests.xml
reporter: java-junit
reporter: swift-xunit
fail-on-error: false

- name: summary
Expand Down
8 changes: 4 additions & 4 deletions Tests/AppcastTests/AlwaysPassTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
// Licensed under MIT-style license (see LICENSE.txt file).
//

import XCTest
import Testing
@testable import Appcast

/// Ensures at least one unit test will pass.
final class AlwaysPassTests: XCTestCase {
func test_alwaysPass() throws {
XCTAssertTrue(true, "This test will always pass.")
struct AlwaysPassTests {
@Test func alwaysPass() {
#expect(Bool(true), "This test will always pass.")
}
}
16 changes: 8 additions & 8 deletions Tests/AppcastTests/SPUAppcastItemStateTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@
// Licensed under MIT-style license (see LICENSE.txt file).
//

import XCTest
import Testing
@testable import Appcast

class SPUAppcastItemStateTests: XCTestCase {
struct SPUAppcastItemStateTests {

func test_init() throws {
@Test func init_SPUAppcastItemState() throws {
// Arrange
// Act
let itemState = SPUAppcastItemState(withMajorUpgrade: true, criticalUpdate: true, informationalUpdate: true, minimumOperatingSystemVersionIsOK: true, maximumOperatingSystemVersionIsOK: true)

// Assert
XCTAssertTrue(itemState.majorUpgrade)
XCTAssertTrue(itemState.criticalUpdate)
XCTAssertTrue(itemState.informationalUpdate)
XCTAssertTrue(itemState.minimumOperatingSystemVersionIsOK)
XCTAssertTrue(itemState.maximumOperatingSystemVersionIsOK)
#expect(itemState.majorUpgrade)
#expect(itemState.criticalUpdate)
#expect(itemState.informationalUpdate)
#expect(itemState.minimumOperatingSystemVersionIsOK)
#expect(itemState.maximumOperatingSystemVersionIsOK)
}
}
15 changes: 8 additions & 7 deletions Tests/AppcastTests/SPUDownloadDataTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
// Licensed under MIT-style license (see LICENSE.txt file).
//

import XCTest
import Foundation
import Testing
@testable import Appcast

class SPUDownloadDataTests: XCTestCase {
struct SPUDownloadDataTests {

func test_init() throws {
@Test func init_SPUDownloadData() throws {
// Arrange
let data = Data()
let url = URL(string: "https://example.org")!
Expand All @@ -19,9 +20,9 @@ class SPUDownloadDataTests: XCTestCase {
let downloadData = SPUDownloadData(withData: data, URL: url, textEncodingName: textEncodingName, MIMEType: mimeType)

// Assert
XCTAssertEqual(downloadData.data, data)
XCTAssertEqual(downloadData.URL, url)
XCTAssertEqual(downloadData.textEncodingName, textEncodingName)
XCTAssertEqual(downloadData.MIMEType, mimeType)
#expect(downloadData.data == data)
#expect(downloadData.URL == url)
#expect(downloadData.textEncodingName == textEncodingName)
#expect(downloadData.MIMEType == mimeType)
}
}
5 changes: 2 additions & 3 deletions Tests/AppcastTests/SUAppcastItemBaseTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
// Licensed under MIT-style license (see LICENSE.txt file).
//

import XCTest
import Testing
@testable import Appcast

class SUAppcastItemBaseTests: XCTestCase {

class SUAppcastItemBaseTests {
func createBasicAppcastItemDictionary() -> SUAppcastItemProperties {
var dict = SUAppcastItemProperties()
dict[SURSSElement.Title] = "Acme v1.0"
Expand Down
22 changes: 11 additions & 11 deletions Tests/AppcastTests/SUAppcastItemTests+displayVersionString.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
// Licensed under MIT-style license (see LICENSE.txt file).
//

import XCTest
import Testing
@testable import Appcast

class SUAppcastItemTests_displayVersionString: SUAppcastItemBaseTests {
final class SUAppcastItemTests_displayVersionString: SUAppcastItemBaseTests {
// MARK: displayVersionString() tests
/// When update has only the `<sparkle:version>` element the ``SUAppcastItem.displayVersionString`` value is equal to the ``SUAppcastItem.versionString`` value.
func test_displayVersionString_appcastWithoutSparkleShortVersionStringValue() throws {
@Test func displayVersionString_appcastWithoutSparkleShortVersionStringValue() throws {
// Arrange
let item = try self.createAppcastItemWithShortVersionString(sparkleVersion: "1.4.8", sparkleShortVersion: nil)

Expand All @@ -18,12 +18,12 @@ class SUAppcastItemTests_displayVersionString: SUAppcastItemBaseTests {
let displayVersion = item.displayVersionString

// Assert
XCTAssertEqual("1.4.8", version)
XCTAssertEqual(version, displayVersion)
#expect("1.4.8" == version)
#expect(version == displayVersion)
}

/// When update has the `<sparkle:sparkleShortVersion>` element, use it for the ``SUAppcastItem.displayVersionString`` value.
func test_displayVersionString_appcastWithSparkleShortVersionStringElement() throws {
@Test func displayVersionString_appcastWithSparkleShortVersionStringElement() throws {
// Arrange
let item = try self.createAppcastItemWithShortVersionString(sparkleVersion: "1799", sparkleShortVersion: "2.3.0")

Expand All @@ -32,13 +32,13 @@ class SUAppcastItemTests_displayVersionString: SUAppcastItemBaseTests {
let displayVersion = item.displayVersionString

// Assert
XCTAssertEqual("1799", version)
XCTAssertEqual("2.3.0", displayVersion)
#expect("1799" == version)
#expect("2.3.0" == displayVersion)
}

/// Sparkle 1.0 supports the `<enclosure sparkle:shortVersionString="1.0.2">` attribute.
/// This value is prefered over the `<sparkle:sparkleShortVersion>` element based on the original implementation.
func test_displayVersionString_enclosureElementWithShortVersionStringAttribute() throws {
@Test func displayVersionString_enclosureElementWithShortVersionStringAttribute() throws {
// Arrange
let item = try self.createLegacyAppcastItemWithEnclosureShortVersionString(sparkleVersion: "1430", sparkleShortVersion: "1.0.2")

Expand All @@ -47,8 +47,8 @@ class SUAppcastItemTests_displayVersionString: SUAppcastItemBaseTests {
let displayVersion = item.displayVersionString

// Assert
XCTAssertEqual("1430", version)
XCTAssertEqual("1.0.2", displayVersion)
#expect("1430" == version)
#expect("1.0.2" == displayVersion)
}

// MARK: helper methods for creating test data
Expand Down
22 changes: 11 additions & 11 deletions Tests/AppcastTests/SUAppcastItemTests+isCriticalUpdate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
// Licensed under MIT-style license (see LICENSE.txt file).
//

import XCTest
import Testing
@testable import Appcast

class SUAppcastItemTests_isCriticalUpdate: SUAppcastItemBaseTests {
final class SUAppcastItemTests_isCriticalUpdate: SUAppcastItemBaseTests {
// MARK: isCriticalUpdate() tests
func test_isCriticalUpdate_nilState_isFalseByDefault() throws {
@Test func isCriticalUpdate_nilState_isFalseByDefault() throws {
// Arrange
let expectedResolvedState: SPUAppcastItemState? = nil
let dict = self.createBasicAppcastItemDictionary()
Expand All @@ -19,10 +19,10 @@ class SUAppcastItemTests_isCriticalUpdate: SUAppcastItemBaseTests {
let actualCriticalUpdate = item.isCriticalUpdate

// Assert
XCTAssertFalse(actualCriticalUpdate)
#expect(!actualCriticalUpdate)
}

func test_isCriticalUpdate_stateWithCriticalUpdate_isTrue() throws {
@Test func isCriticalUpdate_stateWithCriticalUpdate_isTrue() throws {
// Arrange
let expectedResolvedState = SPUAppcastItemState(withMajorUpgrade: false, criticalUpdate: true, informationalUpdate: false, minimumOperatingSystemVersionIsOK: false, maximumOperatingSystemVersionIsOK: false)
let dict = self.createBasicAppcastItemDictionary()
Expand All @@ -33,10 +33,10 @@ class SUAppcastItemTests_isCriticalUpdate: SUAppcastItemBaseTests {
let actualCriticalUpdate = item.isCriticalUpdate

// Assert
XCTAssertTrue(actualCriticalUpdate)
#expect(actualCriticalUpdate)
}

func test_isCriticalUpdate_dictionaryWithCriticalUpdateInformation_isTrue() throws {
@Test func isCriticalUpdate_dictionaryWithCriticalUpdateInformation_isTrue() throws {
// Arrange
let dict = self.createAppcastItemWithCriticalUpdateDictionary()

Expand All @@ -46,10 +46,10 @@ class SUAppcastItemTests_isCriticalUpdate: SUAppcastItemBaseTests {
let actualCriticalUpdate = item.isCriticalUpdate

// Assert
XCTAssertTrue(actualCriticalUpdate)
#expect(actualCriticalUpdate)
}

func test_isCriticalUpdate_legacyCriticalUpdateInformationInTag_isTrue() throws {
@Test func isCriticalUpdate_legacyCriticalUpdateInformationInTag_isTrue() throws {
// Arrange
let dict = self.createAppcastItemWithLegacyTagWithCriticalUpdateDictionary()

Expand All @@ -59,8 +59,8 @@ class SUAppcastItemTests_isCriticalUpdate: SUAppcastItemBaseTests {
let actualCriticalUpdate = item.isCriticalUpdate

// Assert
try XCTSkipUnless(actualCriticalUpdate, "Legacy format of critical updates in the <sparkle:tags> element are not supported.")
XCTAssertTrue(actualCriticalUpdate)
//try XCTSkipUnless(actualCriticalUpdate, "Legacy format of critical updates in the <sparkle:tags> element are not supported.")
#expect(actualCriticalUpdate)
}

// MARK: - helper functions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
// Licensed under MIT-style license (see LICENSE.txt file).
//

import XCTest
import Testing
@testable import Appcast

class SUAppcastItemTests_isInformationOnlyUpdate: SUAppcastItemBaseTests {
final class SUAppcastItemTests_isInformationOnlyUpdate: SUAppcastItemBaseTests {
// MARK: isInformationOnlyUpdate() tests
func test_isInformationOnlyUpdate_nilState_isFalseByDefault() throws {
@Test func isInformationOnlyUpdate_nilState_isFalseByDefault() throws {
let expectedResolvedState: SPUAppcastItemState? = nil
let dict = self.createBasicAppcastItemDictionary()

Expand All @@ -18,10 +18,10 @@ class SUAppcastItemTests_isInformationOnlyUpdate: SUAppcastItemBaseTests {
let actualInformationOnlyUpdate = item.isInformationOnlyUpdate

// Assert
XCTAssertFalse(actualInformationOnlyUpdate)
#expect(!actualInformationOnlyUpdate)
}

func test_isInformationOnlyUpdate_stateWithInformationOnlyUpdate_isTrue() throws {
@Test func isInformationOnlyUpdate_stateWithInformationOnlyUpdate_isTrue() throws {
let expectedResolvedState = SPUAppcastItemState(withMajorUpgrade: false, criticalUpdate: true, informationalUpdate: true, minimumOperatingSystemVersionIsOK: false, maximumOperatingSystemVersionIsOK: false)

let dict = self.createBasicAppcastItemDictionary()
Expand All @@ -31,6 +31,6 @@ class SUAppcastItemTests_isInformationOnlyUpdate: SUAppcastItemBaseTests {
let actualInformationOnlyUpdate = item.isInformationOnlyUpdate

// Assert
XCTAssertTrue(actualInformationOnlyUpdate)
#expect(actualInformationOnlyUpdate)
}
}
12 changes: 6 additions & 6 deletions Tests/AppcastTests/SUAppcastItemTests+isMajorUpgrade.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
// Licensed under MIT-style license (see LICENSE.txt file).
//

import XCTest
import Testing
@testable import Appcast

class SUAppcastItemTests_isMajorUpgrade: SUAppcastItemBaseTests {
final class SUAppcastItemTests_isMajorUpgrade: SUAppcastItemBaseTests {
// MARK: isMajorUpgrade() tests
func test_isMajorUpgrade_noResolvedState_isFalseByDefault() throws {
@Test func isMajorUpgrade_noResolvedState_isFalseByDefault() throws {
let expectedResolvedState: SPUAppcastItemState? = nil
let dict = self.createBasicAppcastItemDictionary()

Expand All @@ -18,10 +18,10 @@ class SUAppcastItemTests_isMajorUpgrade: SUAppcastItemBaseTests {
let actualMajorUpgrade = item.isMajorUpgrade

// Assert
XCTAssertFalse(actualMajorUpgrade)
#expect(!actualMajorUpgrade, "Appcast item must hase isMajorUpgrade set to false")
}

func test_isMajorUpgrade_stateWithMajorUpgrade_isTrue() throws {
@Test func isMajorUpgrade_stateWithMajorUpgrade_isTrue() throws {
let expectedResolvedState = SPUAppcastItemState(withMajorUpgrade: true, criticalUpdate: false, informationalUpdate: false, minimumOperatingSystemVersionIsOK: false, maximumOperatingSystemVersionIsOK: false)

let dict = self.createBasicAppcastItemDictionary()
Expand All @@ -31,6 +31,6 @@ class SUAppcastItemTests_isMajorUpgrade: SUAppcastItemBaseTests {
let actualMajorUpgrade = item.isMajorUpgrade

// Assert
XCTAssertTrue(actualMajorUpgrade)
#expect(actualMajorUpgrade, "Appcast item must hase isMajorUpgrade set to true")
}
}
Loading