Skip to content

Commit

Permalink
add linux support (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
BrentMifsud committed Sep 2, 2022
1 parent 80ee598 commit ea22972
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/Build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
build:
strategy:
matrix:
platform: [macos-latest]
platform: [macos-latest, ubuntu-latest]
runs-on: ${{ matrix.platform }}

steps:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
![Supported Platforms](https://img.shields.io/static/v1?label=Supported%20Platforms&message=iOS%20|%20macOS%20|%20tvOS%20|%20watchOS&color=red&style=flat&logo=swift&labelColor=white) ![Swift Versions](https://img.shields.io/static/v1?label=Swift&message=5.5&color=red&style=flat&logo=swift&labelColor=white)
![Supported Platforms](https://img.shields.io/static/v1?label=Supported%20Platforms&message=iOS%20|%20macOS%20|%20tvOS%20|%20watchOS%20|%20linux&color=red&style=flat&logo=swift&labelColor=white) ![Swift Versions](https://img.shields.io/static/v1?label=Swift&message=5.5&color=red&style=flat&logo=swift&labelColor=white)

# AsyncValue

Expand Down
31 changes: 19 additions & 12 deletions Tests/AsyncValueTests/AsyncValueTests.swift
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
import Combine
import XCTest
@testable import AsyncValue

final class AsyncValueTests: XCTestCase {
var sut: AsyncValue<String>?
var cancellable: AnyCancellable?


override func tearDown() {
super.tearDown()
sut = nil
cancellable = nil
}


func test_allValues() async throws {
sut = .init(wrappedValue: "Test")

Expand Down Expand Up @@ -61,15 +59,29 @@ final class AsyncValueTests: XCTestCase {

await testTask.value
}

}

#if canImport(Combine) && canImport(SwiftUI)
import Combine
import SwiftUI

extension AsyncValueTests {
fileprivate class TestObservableObject: ObservableObject {
var cancellable: AnyCancellable?

@AsyncValue var myValue = "Test" {
willSet { objectWillChange.send() }
}
}

func test_observableObjectPublisher() {
let sut = TestObservableObject()

let exp = expectation(description: "wait for combine publisher")

var updateCount: Int = 0

cancellable = sut.objectWillChange.sink {
sut.cancellable = sut.objectWillChange.sink {
updateCount += 1
}

Expand All @@ -86,9 +98,4 @@ final class AsyncValueTests: XCTestCase {
XCTAssertEqual(updateCount, 2)
}
}

fileprivate class TestObservableObject: ObservableObject {
@AsyncValue var myValue = "Test" {
willSet { objectWillChange.send() }
}
}
#endif

0 comments on commit ea22972

Please sign in to comment.