-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix dependency test trait for stateful dependencies. (#314)
* Fix dependency test trait for stateful dependencies. * fix older platforms
- Loading branch information
Showing
2 changed files
with
37 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#if canImport(Testing) | ||
import Dependencies | ||
import DependenciesTestSupport | ||
import Foundation | ||
import Testing | ||
|
||
@Suite(.dependency(\.uuid, .incrementing)) | ||
struct TestTraitTests { | ||
@Dependency(\.uuid) var uuid | ||
|
||
@Test func statefulDependency1() async throws { | ||
for index in 0...100 { | ||
#expect(uuid() == UUID(index)) | ||
try await Task.sleep(for: .milliseconds(1)) | ||
} | ||
} | ||
|
||
@Test func statefulDependency2() async throws { | ||
for index in 0...100 { | ||
#expect(uuid() == UUID(index)) | ||
try await Task.sleep(for: .milliseconds(1)) | ||
} | ||
} | ||
|
||
@Test func statefulDependency3() async throws { | ||
for index in 0...100 { | ||
#expect(uuid() == UUID(index)) | ||
try await Task.sleep(for: .milliseconds(1)) | ||
} | ||
} | ||
} | ||
#endif |