Skip to content

Commit

Permalink
fix tests on linux
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-zethraeus committed Feb 27, 2023
1 parent 868ef5d commit b4687cc
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 35 deletions.
4 changes: 2 additions & 2 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/GoodHatsLLC/Disposable.git",
"state" : {
"revision" : "bc36c179b694a2f319d1abd487dcf016e4317bf4",
"version" : "0.6.1"
"revision" : "993f5c38c28760fd09e177ed117d7c3577ca919f",
"version" : "0.6.2"
}
}
],
Expand Down
8 changes: 4 additions & 4 deletions Tests/EmitterTests/OperatorTests/CombineLatestTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ final class CombineLatestTests: XCTestCase {
weak var weakSourceA: PublishSubject<Int>?
weak var weakSourceB: ValueSubject<String>?

autoreleasepool {
autoreleasepool {
({
({
let sourceA: PublishSubject<Int> = .init()
let sourceB: ValueSubject<String> = .init("Hi")
weakSourceA = sourceA
Expand All @@ -73,11 +73,11 @@ final class CombineLatestTests: XCTestCase {
sourceA.emit(.value(3))
sourceB.emit(.value("b"))
sourceB.emit(.value("c"))
}
})()
XCTAssertNotNil(weakSourceA)
XCTAssertNotNil(weakSourceB)
stage.dispose()
}
})()
XCTAssertNil(weakSourceA)
XCTAssertNil(weakSourceB)
}
Expand Down
8 changes: 4 additions & 4 deletions Tests/EmitterTests/OperatorTests/CompactMapTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ final class CompactMapTests: XCTestCase {
var record: [Int] = []
weak var weakSourceA: PublishSubject<Int?>?

autoreleasepool {
autoreleasepool {
({
({
let sourceA: PublishSubject<Int?> = .init()
weakSourceA = sourceA

Expand All @@ -57,10 +57,10 @@ final class CompactMapTests: XCTestCase {
sourceA.emit(.value(2))
sourceA.emit(.value(nil))
sourceA.emit(.value(3))
}
})()
XCTAssertNotNil(weakSourceA)
stage.dispose()
}
})()
XCTAssertNil(weakSourceA)
}

Expand Down
8 changes: 4 additions & 4 deletions Tests/EmitterTests/OperatorTests/FilterTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ final class FilterTests: XCTestCase {
var record: [Int] = []
weak var weakSourceA: PublishSubject<Int>?

autoreleasepool {
autoreleasepool {
({
({
let sourceA: PublishSubject<Int> = .init()
weakSourceA = sourceA

Expand All @@ -57,10 +57,10 @@ final class FilterTests: XCTestCase {
sourceA.emit(.value(2))
sourceA.emit(.value(99))
sourceA.emit(.value(3))
}
})()
XCTAssertNotNil(weakSourceA)
stage.dispose()
}
})()
XCTAssertNil(weakSourceA)
}

Expand Down
16 changes: 8 additions & 8 deletions Tests/EmitterTests/OperatorTests/FlatMapLatestTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ final class FlatMapLatestTests: XCTestCase {
weak var weakSourceA: PublishSubject<Int>?
weak var weakSourceB: ValueSubject<String>?

autoreleasepool {
autoreleasepool {
({
({
let sourceA: PublishSubject<Int> = .init()
let sourceB: ValueSubject<String> = .init("initial")
weakSourceA = sourceA
Expand All @@ -104,11 +104,11 @@ final class FlatMapLatestTests: XCTestCase {
sourceA.emit(.value(3))
sourceA.emit(.value(0))
sourceB.emit(.value("c"))
}
})()
XCTAssertNotNil(weakSourceA)
XCTAssertNotNil(weakSourceB)
stage.dispose()
}
})()
XCTAssertNil(weakSourceA)
XCTAssertNil(weakSourceB)

Expand All @@ -120,8 +120,8 @@ final class FlatMapLatestTests: XCTestCase {
weak var weakSourceA: ValueSubject<Int>?
weak var weakSourceB: PublishSubject<String>?

autoreleasepool {
autoreleasepool {
({
({
let sourceA: ValueSubject<Int> = .init(0)
let sourceB: PublishSubject<String> = .init()
weakSourceA = sourceA
Expand All @@ -145,11 +145,11 @@ final class FlatMapLatestTests: XCTestCase {
sourceA.emit(.value(3))
sourceA.emit(.value(0))
sourceB.emit(.value("c"))
}
})()
XCTAssertNotNil(weakSourceA)
XCTAssertNotNil(weakSourceB)
stage.dispose()
}
})()
XCTAssertNil(weakSourceA)
XCTAssertNil(weakSourceB)

Expand Down
8 changes: 4 additions & 4 deletions Tests/EmitterTests/OperatorTests/MapTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ final class MapTests: XCTestCase {
var record: [Int] = []
weak var weakSourceA: PublishSubject<Int>?

autoreleasepool {
autoreleasepool {
({
({
let sourceA: PublishSubject<Int> = .init()
weakSourceA = sourceA

Expand All @@ -57,10 +57,10 @@ final class MapTests: XCTestCase {
sourceA.emit(.value(3))
sourceA.emit(.value(4))
sourceA.emit(.value(5))
}
})()
XCTAssertNotNil(weakSourceA)
stage.dispose()
}
})()
XCTAssertNil(weakSourceA)
}

Expand Down
8 changes: 4 additions & 4 deletions Tests/EmitterTests/OperatorTests/MergeTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ final class MergeTests: XCTestCase {
weak var weakSourceA: PublishSubject<Int>?
weak var weakSourceB: PublishSubject<String>?

autoreleasepool {
autoreleasepool {
({
({
let sourceA: PublishSubject<Int> = .init()
let sourceB: PublishSubject<String> = .init()
weakSourceA = sourceA
Expand All @@ -64,11 +64,11 @@ final class MergeTests: XCTestCase {
sourceA.emit(.value(3))
sourceB.emit(.value("b"))
sourceB.emit(.value("c"))
}
})()
XCTAssertNotNil(weakSourceA)
XCTAssertNotNil(weakSourceB)
stage.reset()
}
})()
XCTAssertNil(weakSourceA)
XCTAssertNil(weakSourceB)

Expand Down
8 changes: 4 additions & 4 deletions Tests/EmitterTests/OperatorTests/RemoveDuplicateTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ final class RemoveDuplicatesTests: XCTestCase {
let record: Unchecked<[Int]> = .init([])
weak var weakSourceA: PublishSubject<Int>?

autoreleasepool {
autoreleasepool {
({
({
let sourceA: PublishSubject<Int> = .init()
weakSourceA = sourceA

Expand All @@ -58,10 +58,10 @@ final class RemoveDuplicatesTests: XCTestCase {
sourceA.emit(.value(3))
sourceA.emit(.value(3))
sourceA.emit(.value(1))
}
})()
XCTAssertNotNil(weakSourceA)
stage.dispose()
}
})()
XCTAssertNil(weakSourceA)
XCTAssertEqual([1, 2, 3, 1], record.value)
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/EmitterTests/Utils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Sendable {
extension Task where Success == (), Failure == Error {
static func flushHack(count: Int = 25) async {
for _ in 0..<count {
_ = await Task<(), Error> { try await Task<_, Never>.sleep(nanoseconds: 1 * USEC_PER_SEC) }.result
_ = await Task<(), Error> { try await Task<_, Never>.sleep(nanoseconds: 1_000_000) }.result
}
}

Expand Down

0 comments on commit b4687cc

Please sign in to comment.