File tree Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change 1
1
public struct _DependenciesTrait : Sendable {
2
- package let updateValues : @Sendable ( inout DependencyValues ) -> Void
2
+ package let updateValues : @Sendable ( inout DependencyValues ) throws -> Void
3
3
4
- package init ( _ updateValues: @escaping @Sendable ( inout DependencyValues ) -> Void ) {
4
+ package init ( _ updateValues: @escaping @Sendable ( inout DependencyValues ) throws -> Void ) {
5
5
self . updateValues = updateValues
6
6
}
7
7
Original file line number Diff line number Diff line change 43
43
/// - value: A dependency value to override for the test.
44
44
public static func dependency< Value> (
45
45
_ keyPath: WritableKeyPath < DependencyValues , Value > & Sendable ,
46
- _ value: @autoclosure @escaping @Sendable ( ) -> Value
46
+ _ value: @autoclosure @escaping @Sendable ( ) throws -> Value
47
47
) -> Self {
48
48
Self {
49
- $0 [ keyPath: keyPath] = value ( )
49
+ $0 [ keyPath: keyPath] = try value ( )
50
50
}
51
51
}
52
52
79
79
/// - keyPath: A key path to a dependency value.
80
80
/// - value: A dependency value to override for the test.
81
81
public static func dependency< Value: TestDependencyKey > (
82
- _ value: @autoclosure @escaping @Sendable ( ) -> Value
82
+ _ value: @autoclosure @escaping @Sendable ( ) throws -> Value
83
83
) -> Self where Value == Value . Value {
84
- Self { $0 [ Value . self] = value ( ) }
84
+ Self { $0 [ Value . self] = try value ( ) }
85
85
}
86
86
87
87
/// A trait that overrides a test's or suite's dependencies.
96
96
public var isRecursive : Bool { true }
97
97
98
98
public func prepare( for test: Test ) async throws {
99
- testValuesByTestID. withValue {
100
- self . updateValues ( & $0[ test. id, default: DependencyValues ( context: . test) ] )
99
+ try testValuesByTestID. withValue {
100
+ try self . updateValues ( & $0[ test. id, default: DependencyValues ( context: . test) ] )
101
101
}
102
102
}
103
103
}
You can’t perform that action at this time.
0 commit comments