-
I tried to write a test with swift-testing using parameterized inputs, but it looked like the test values were overwriting each other. I wrote this minimal example to show what I'm seeing: struct Parameterized {
@Test(arguments: [23, 42])
func test(_ input: Int) {
@Shared(.appStorage("count")) var count = input
#expect(count == input)
}
} One of the two tests always fails because |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
This is because our Dependencies library, which is what There are docs on this, but they are over in the Dependencies library: |
Beta Was this translation helpful? Give feedback.
This is because our Dependencies library, which is what
@Shared
uses under the hood, does not work with parameterized tests. We are waiting for Swift Testing to support "scoped traits" (coming Swift 6.1) to properly quarantine dependencies on a per-test basis.There are docs on this, but they are over in the Dependencies library:
https://swiftpackageindex.com/pointfreeco/swift-dependencies/main/documentation/dependencies/testing#Parameterized-Test-cases