File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,21 @@ final class TaskTimeoutTests: XCTestCase {
56
56
}
57
57
}
58
58
59
+ func testSendable_ReturnsValue( ) async throws {
60
+ let sendable = TestActor ( )
61
+ let value = try await withThrowingTimeout ( seconds: 1 ) {
62
+ sendable
63
+ }
64
+ XCTAssertTrue ( value === sendable)
65
+ }
66
+
67
+ func testNonSendable_ReturnsValue( ) async throws {
68
+ let ns = try await withThrowingTimeout ( seconds: 1 ) {
69
+ NonSendable ( " chips " )
70
+ }
71
+ XCTAssertEqual ( ns. value, " chips " )
72
+ }
73
+
59
74
func testActor_ReturnsValue( ) async throws {
60
75
let val = try await TestActor ( ) . returningString ( " Fish " )
61
76
XCTAssertEqual ( val, " Fish " )
@@ -74,6 +89,14 @@ final class TaskTimeoutTests: XCTestCase {
74
89
}
75
90
}
76
91
92
+ public struct NonSendable < T> {
93
+ public var value : T
94
+
95
+ init ( _ value: T ) {
96
+ self . value = value
97
+ }
98
+ }
99
+
77
100
final actor TestActor {
78
101
79
102
func returningString( _ string: String = " Fish " , after sleep: TimeInterval = 0 , timeout: TimeInterval = 1 ) async throws -> String {
You can’t perform that action at this time.
0 commit comments