Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public final class MockReturningNonParameterizedAsyncMethod<ReturnValue> {
public var implementation: Implementation = .unimplemented

/// The number of times the method has been called.
@Locked(.unchecked)
@Locked(.checked)
public private(set) var callCount: Int = .zero

/// All the values that have been returned by the method.
Expand Down Expand Up @@ -103,7 +103,7 @@ public final class MockReturningNonParameterizedAsyncMethod<ReturnValue> {
/// - Returns: A value, if ``implementation-swift.property`` returns a
/// value.
private func invoke() async -> ReturnValue {
self._callCount.withLockUnchecked { callCount in
self._callCount.withLock { callCount in
callCount += 1
}

Expand All @@ -125,7 +125,7 @@ public final class MockReturningNonParameterizedAsyncMethod<ReturnValue> {
self._implementation.withLockUnchecked { implementation in
implementation = .unimplemented
}
self._callCount.withLockUnchecked { callCount in
self._callCount.withLock { callCount in
callCount = .zero
}
self._returnedValues.withLockUnchecked { returnedValues in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public final class MockReturningNonParameterizedAsyncThrowingMethod<ReturnValue>
public var implementation: Implementation = .unimplemented

/// The number of times the method has been called.
@Locked(.unchecked)
@Locked(.checked)
public private(set) var callCount: Int = .zero

/// All the values that have been returned by the method.
Expand Down Expand Up @@ -105,7 +105,7 @@ public final class MockReturningNonParameterizedAsyncThrowingMethod<ReturnValue>
/// - Returns: A value, if ``implementation-swift.property`` returns a
/// value.
private func invoke() async throws -> ReturnValue {
self._callCount.withLockUnchecked { callCount in
self._callCount.withLock { callCount in
callCount += 1
}

Expand All @@ -131,7 +131,7 @@ public final class MockReturningNonParameterizedAsyncThrowingMethod<ReturnValue>
self._implementation.withLockUnchecked { implementation in
implementation = .unimplemented
}
self._callCount.withLockUnchecked { callCount in
self._callCount.withLock { callCount in
callCount = .zero
}
self._returnedValues.withLockUnchecked { returnedValues in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public final class MockReturningNonParameterizedMethod<ReturnValue> {
public var implementation: Implementation = .unimplemented

/// The number of times the method has been called.
@Locked(.unchecked)
@Locked(.checked)
public private(set) var callCount: Int = .zero

/// All the values that have been returned by the method.
Expand Down Expand Up @@ -101,7 +101,7 @@ public final class MockReturningNonParameterizedMethod<ReturnValue> {
/// - Returns: A value, if ``implementation-swift.property`` returns a
/// value.
private func invoke() -> ReturnValue {
self._callCount.withLockUnchecked { callCount in
self._callCount.withLock { callCount in
callCount += 1
}

Expand All @@ -123,7 +123,7 @@ public final class MockReturningNonParameterizedMethod<ReturnValue> {
self._implementation.withLockUnchecked { implementation in
implementation = .unimplemented
}
self._callCount.withLockUnchecked { callCount in
self._callCount.withLock { callCount in
callCount = .zero
}
self._returnedValues.withLockUnchecked { returnedValues in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public final class MockReturningNonParameterizedThrowingMethod<ReturnValue> {
public var implementation: Implementation = .unimplemented

/// The number of times the method has been called.
@Locked(.unchecked)
@Locked(.checked)
public private(set) var callCount: Int = .zero

/// All the values that have been returned by the method.
Expand Down Expand Up @@ -105,7 +105,7 @@ public final class MockReturningNonParameterizedThrowingMethod<ReturnValue> {
/// - Returns: A value, if ``implementation-swift.property`` returns a
/// value.
private func invoke() throws -> ReturnValue {
self._callCount.withLockUnchecked { callCount in
self._callCount.withLock { callCount in
callCount += 1
}

Expand All @@ -131,7 +131,7 @@ public final class MockReturningNonParameterizedThrowingMethod<ReturnValue> {
self._implementation.withLockUnchecked { implementation in
implementation = .unimplemented
}
self._callCount.withLockUnchecked { callCount in
self._callCount.withLock { callCount in
callCount = .zero
}
self._returnedValues.withLockUnchecked { returnedValues in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public final class MockReturningParameterizedAsyncMethod<
public var implementation: Implementation = .unimplemented

/// The number of times the method has been called.
@Locked(.unchecked)
@Locked(.checked)
public private(set) var callCount: Int = .zero

/// All the arguments with which the method has been invoked.
Expand Down Expand Up @@ -140,7 +140,7 @@ public final class MockReturningParameterizedAsyncMethod<
/// - Parameter arguments: The arguments with which the method is being
/// invoked.
private func recordInput(arguments: Arguments) {
self._callCount.withLockUnchecked { callCount in
self._callCount.withLock { callCount in
callCount += 1
}
self._invocations.withLockUnchecked { invocations in
Expand Down Expand Up @@ -176,7 +176,7 @@ public final class MockReturningParameterizedAsyncMethod<
self._implementation.withLockUnchecked { implementation in
implementation = .unimplemented
}
self._callCount.withLockUnchecked { callCount in
self._callCount.withLock { callCount in
callCount = .zero
}
self._invocations.withLockUnchecked { invocations in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public final class MockReturningParameterizedAsyncThrowingMethod<
public var implementation: Implementation = .unimplemented

/// The number of times the method has been called.
@Locked(.unchecked)
@Locked(.checked)
public private(set) var callCount: Int = .zero

/// All the arguments with which the method has been invoked.
Expand Down Expand Up @@ -148,7 +148,7 @@ public final class MockReturningParameterizedAsyncThrowingMethod<
/// - Parameter arguments: The arguments with which the method is being
/// invoked.
private func recordInput(arguments: Arguments) {
self._callCount.withLockUnchecked { callCount in
self._callCount.withLock { callCount in
callCount += 1
}
self._invocations.withLockUnchecked { invocations in
Expand Down Expand Up @@ -184,7 +184,7 @@ public final class MockReturningParameterizedAsyncThrowingMethod<
self._implementation.withLockUnchecked { implementation in
implementation = .unimplemented
}
self._callCount.withLockUnchecked { callCount in
self._callCount.withLock { callCount in
callCount = .zero
}
self._invocations.withLockUnchecked { invocations in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public final class MockReturningParameterizedMethod<
public var implementation: Implementation = .unimplemented

/// The number of times the method has been called.
@Locked(.unchecked)
@Locked(.checked)
public private(set) var callCount: Int = .zero

/// All the arguments with which the method has been invoked.
Expand Down Expand Up @@ -140,7 +140,7 @@ public final class MockReturningParameterizedMethod<
/// - Parameter arguments: The arguments with which the method is being
/// invoked.
private func recordInput(arguments: Arguments) {
self._callCount.withLockUnchecked { callCount in
self._callCount.withLock { callCount in
callCount += 1
}
self._invocations.withLockUnchecked { invocations in
Expand Down Expand Up @@ -176,7 +176,7 @@ public final class MockReturningParameterizedMethod<
self._implementation.withLockUnchecked { implementation in
implementation = .unimplemented
}
self._callCount.withLockUnchecked { callCount in
self._callCount.withLock { callCount in
callCount = .zero
}
self._invocations.withLockUnchecked { invocations in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public final class MockReturningParameterizedThrowingMethod<
public var implementation: Implementation = .unimplemented

/// The number of times the method has been called.
@Locked(.unchecked)
@Locked(.checked)
public private(set) var callCount: Int = .zero

/// All the arguments with which the method has been invoked.
Expand Down Expand Up @@ -147,7 +147,7 @@ public final class MockReturningParameterizedThrowingMethod<
/// - Parameter arguments: The arguments with which the method is being
/// invoked.
private func recordInput(arguments: Arguments) {
self._callCount.withLockUnchecked { callCount in
self._callCount.withLock { callCount in
callCount += 1
}
self._invocations.withLockUnchecked { invocations in
Expand Down Expand Up @@ -183,7 +183,7 @@ public final class MockReturningParameterizedThrowingMethod<
self._implementation.withLockUnchecked { implementation in
implementation = .unimplemented
}
self._callCount.withLockUnchecked { callCount in
self._callCount.withLock { callCount in
callCount = .zero
}
self._invocations.withLockUnchecked { invocations in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public final class MockVoidNonParameterizedAsyncMethod: Sendable {
public var implementation: Implementation = .unimplemented

/// The number of times the method has been called.
@Locked(.unchecked)
@Locked(.checked)
public private(set) var callCount: Int = .zero

// MARK: Initializers
Expand Down Expand Up @@ -68,7 +68,7 @@ public final class MockVoidNonParameterizedAsyncMethod: Sendable {
/// Records the invocation of the method and invokes
/// ``implementation-swift.property``.
private func invoke() async {
self._callCount.withLockUnchecked { callCount in
self._callCount.withLock { callCount in
callCount += 1
}
await self.implementation()
Expand All @@ -81,7 +81,7 @@ public final class MockVoidNonParameterizedAsyncMethod: Sendable {
self._implementation.withLockUnchecked { implementation in
implementation = .unimplemented
}
self._callCount.withLockUnchecked { callCount in
self._callCount.withLock { callCount in
callCount = .zero
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ public final class MockVoidNonParameterizedAsyncThrowingMethod: Sendable {
public var implementation: Implementation = .unimplemented

/// The number of times the method has been called.
@Locked(.unchecked)
@Locked(.checked)
public private(set) var callCount: Int = .zero

/// All the errors that have been thrown by the method.
@Locked(.unchecked)
@Locked(.checked)
public private(set) var thrownErrors: [any Error] = []

/// The last error thrown by the method.
Expand Down Expand Up @@ -78,14 +78,14 @@ public final class MockVoidNonParameterizedAsyncThrowingMethod: Sendable {
/// Records the invocation of the method and invokes
/// ``implementation-swift.property``.
private func invoke() async throws {
self._callCount.withLockUnchecked { callCount in
self._callCount.withLock { callCount in
callCount += 1
}

do {
try await self.implementation()
} catch {
self._thrownErrors.withLockUnchecked { thrownErrors in
self._thrownErrors.withLock { thrownErrors in
thrownErrors.append(error)
}
throw error
Expand All @@ -99,10 +99,10 @@ public final class MockVoidNonParameterizedAsyncThrowingMethod: Sendable {
self._implementation.withLockUnchecked { implementation in
implementation = .unimplemented
}
self._callCount.withLockUnchecked { callCount in
self._callCount.withLock { callCount in
callCount = .zero
}
self._thrownErrors.withLockUnchecked { thrownErrors in
self._thrownErrors.withLock { thrownErrors in
thrownErrors.removeAll()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public final class MockVoidNonParameterizedMethod: Sendable {
public var implementation: Implementation = .unimplemented

/// The number of times the method has been called.
@Locked(.unchecked)
@Locked(.checked)
public private(set) var callCount: Int = .zero

// MARK: Initializers
Expand Down Expand Up @@ -67,7 +67,7 @@ public final class MockVoidNonParameterizedMethod: Sendable {
/// Records the invocation of the method and invokes
/// ``implementation-swift.property``.
private func invoke() {
self._callCount.withLockUnchecked { callCount in
self._callCount.withLock { callCount in
callCount += 1
}
self.implementation()
Expand All @@ -80,7 +80,7 @@ public final class MockVoidNonParameterizedMethod: Sendable {
self._implementation.withLockUnchecked { implementation in
implementation = .unimplemented
}
self._callCount.withLockUnchecked { callCount in
self._callCount.withLock { callCount in
callCount = .zero
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ public final class MockVoidNonParameterizedThrowingMethod: Sendable {
public var implementation: Implementation = .unimplemented

/// The number of times the method has been called.
@Locked(.unchecked)
@Locked(.checked)
public private(set) var callCount: Int = .zero

/// All the errors that have been thrown by the method.
@Locked(.unchecked)
@Locked(.checked)
public private(set) var thrownErrors: [any Error] = []

/// The last error thrown by the method.
Expand Down Expand Up @@ -76,14 +76,14 @@ public final class MockVoidNonParameterizedThrowingMethod: Sendable {
/// Records the invocation of the method and invokes
/// ``implementation-swift.property``.
private func invoke() throws {
self._callCount.withLockUnchecked { callCount in
self._callCount.withLock { callCount in
callCount += 1
}

do {
try self.implementation()
} catch {
self._thrownErrors.withLockUnchecked { thrownErrors in
self._thrownErrors.withLock { thrownErrors in
thrownErrors.append(error)
}
throw error
Expand All @@ -97,10 +97,10 @@ public final class MockVoidNonParameterizedThrowingMethod: Sendable {
self._implementation.withLockUnchecked { implementation in
implementation = .unimplemented
}
self._callCount.withLockUnchecked { callCount in
self._callCount.withLock { callCount in
callCount = .zero
}
self._thrownErrors.withLockUnchecked { thrownErrors in
self._thrownErrors.withLock { thrownErrors in
thrownErrors.removeAll()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public final class MockVoidParameterizedAsyncMethod<
public var implementation: Implementation = .unimplemented

/// The number of times the method has been called.
@Locked(.unchecked)
@Locked(.checked)
public private(set) var callCount: Int = .zero

/// All the arguments with which the method has been invoked.
Expand Down Expand Up @@ -101,7 +101,7 @@ public final class MockVoidParameterizedAsyncMethod<
/// - Parameter arguments: The arguments with which the method is being
/// invoked.
private func recordInput(arguments: Arguments) {
self._callCount.withLockUnchecked { callCount in
self._callCount.withLock { callCount in
callCount += 1
}
self._invocations.withLockUnchecked { invocations in
Expand All @@ -125,7 +125,7 @@ public final class MockVoidParameterizedAsyncMethod<
self._implementation.withLockUnchecked { implementation in
implementation = .unimplemented
}
self._callCount.withLockUnchecked { callCount in
self._callCount.withLock { callCount in
callCount = .zero
}
self._invocations.withLockUnchecked { invocations in
Expand Down
Loading
Loading