Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add linux support #3

Merged
merged 1 commit into from
Sep 2, 2022
Merged
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
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