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 {
6262    /// ## Thread Safety
6363    ///
6464    /// `Instant` is a value type and is inherently thread-safe.
65-     public  struct  Instant :  InstantProtocol  { 
65+     public  struct  Instant :  InstantProtocol ,   CustomStringConvertible  { 
6666        /// The number of milliseconds since the Unix epoch.
6767        let  instant :  Int64 
6868
@@ -122,6 +122,11 @@ public struct LambdaClock: Clock {
122122        public  init ( millisecondsSinceEpoch milliseconds:  Int64 )  { 
123123            self . instant =  milliseconds
124124        } 
125+ 
126+         /// Renders an Instant as an EPOCH value
127+         public  var  description :  String  { 
128+             " \( self . instant) " 
129+         } 
125130    } 
126131
127132    /// The current instant according to this clock.
Original file line number Diff line number Diff line change @@ -136,4 +136,12 @@ struct LambdaClockTests {
136136            " LambdaClock and Foundation Date should be within 10ms of each other, difference was  \( difference) ms " 
137137        ) 
138138    } 
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+     } 
139147} 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments