File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
crates/codspeed/src/instrument_hooks Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -174,3 +174,20 @@ pub use unix_impl::InstrumentHooks;
174174
175175#[ cfg( not( unix) ) ]
176176pub use other_impl:: InstrumentHooks ;
177+
178+ #[ cfg( test) ]
179+ mod tests {
180+ use super :: InstrumentHooks ;
181+
182+ #[ test]
183+ fn test_instrument_hooks ( ) {
184+ let hooks = InstrumentHooks :: instance ( ) ;
185+ assert ! ( !hooks. is_instrumented( ) || hooks. start_benchmark( ) . is_ok( ) ) ;
186+ assert ! ( hooks. set_executed_benchmark( "test_uri" ) . is_ok( ) ) ;
187+ assert ! ( hooks. set_integration( "test_integration" , "1.0.0" ) . is_ok( ) ) ;
188+ let start = InstrumentHooks :: current_timestamp ( ) ;
189+ let end = start + 1_000_000 ; // Simulate 1ms later
190+ hooks. add_benchmark_timestamps ( start, end) ;
191+ assert ! ( !hooks. is_instrumented( ) || hooks. stop_benchmark( ) . is_ok( ) ) ;
192+ }
193+ }
You can’t perform that action at this time.
0 commit comments