File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
Tests/AWSLambdaRuntimeTests Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ public struct LambdaClock: Clock {
62
62
/// ## Thread Safety
63
63
///
64
64
/// `Instant` is a value type and is inherently thread-safe.
65
- public struct Instant : InstantProtocol {
65
+ public struct Instant : InstantProtocol , CustomStringConvertible {
66
66
/// The number of milliseconds since the Unix epoch.
67
67
let instant : Int64
68
68
@@ -122,6 +122,11 @@ public struct LambdaClock: Clock {
122
122
public init ( millisecondsSinceEpoch milliseconds: Int64 ) {
123
123
self . instant = milliseconds
124
124
}
125
+
126
+ /// Renders an Instant as an EPOCH value
127
+ public var description : String {
128
+ " \( self . instant) "
129
+ }
125
130
}
126
131
127
132
/// The current instant according to this clock.
Original file line number Diff line number Diff line change @@ -136,4 +136,12 @@ struct LambdaClockTests {
136
136
" LambdaClock and Foundation Date should be within 10ms of each other, difference was \( difference) ms "
137
137
)
138
138
}
139
+ @Test ( " Instant renders as string with an epoch number " )
140
+ func instantRendersAsStringWithEpochNumber( ) {
141
+ let clock = LambdaClock ( )
142
+ let instant = clock. now
143
+
144
+ let expectedString = " \( instant) "
145
+ #expect( expectedString. allSatisfy { $0. isNumber } , " String should only contain numbers " )
146
+ }
139
147
}
You can’t perform that action at this time.
0 commit comments