-
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.
- Loading branch information
1 parent
e01dfcc
commit 5201882
Showing
4 changed files
with
32 additions
and
32 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
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 |
---|---|---|
@@ -1,33 +1,33 @@ | ||
#if canImport(Testing) | ||
import Dependencies | ||
import Testing | ||
import Dependencies | ||
import Testing | ||
|
||
struct SwiftTestingTests { | ||
@Test | ||
func cachePollution1() async { | ||
await withDependencies { | ||
$0 = DependencyValues() | ||
} operation: { | ||
@Dependency(\.cachedDependency) var cachedDependency: CachedDependency | ||
let value = await cachedDependency.increment() | ||
#expect(value == 1) | ||
struct SwiftTestingTests { | ||
@Test | ||
func cachePollution1() async { | ||
await withDependencies { | ||
$0 = DependencyValues() | ||
} operation: { | ||
@Dependency(\.cachedDependency) var cachedDependency: CachedDependency | ||
let value = await cachedDependency.increment() | ||
#expect(value == 1) | ||
} | ||
} | ||
} | ||
|
||
@Test | ||
func cachePollution2() async { | ||
await withDependencies { | ||
$0 = DependencyValues() | ||
} operation: { | ||
@Dependency(\.cachedDependency) var cachedDependency: CachedDependency | ||
let value = await cachedDependency.increment() | ||
// NB: Wasm has different behavior here. | ||
#if os(WASI) | ||
#expect(value == 2) | ||
#else | ||
#expect(value == 1) | ||
#endif | ||
@Test | ||
func cachePollution2() async { | ||
await withDependencies { | ||
$0 = DependencyValues() | ||
} operation: { | ||
@Dependency(\.cachedDependency) var cachedDependency: CachedDependency | ||
let value = await cachedDependency.increment() | ||
// NB: Wasm has different behavior here. | ||
#if os(WASI) | ||
#expect(value == 2) | ||
#else | ||
#expect(value == 1) | ||
#endif | ||
} | ||
} | ||
} | ||
} | ||
#endif |