chore: restore product scaffold to rollback baseline
This commit is contained in:
@@ -774,6 +774,11 @@ impl ProtocolEventRecorder {
|
||||
pub fn drain(&mut self) -> Vec<String> {
|
||||
std::mem::take(&mut self.events)
|
||||
}
|
||||
|
||||
/// Snapshot all recorded events without clearing the buffer.
|
||||
pub fn snapshot(&self) -> Vec<String> {
|
||||
self.events.clone()
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for ProtocolEventRecorder {
|
||||
@@ -1080,4 +1085,17 @@ mod tests {
|
||||
"explicit with_android_audio(None) must also omit the section"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn protocol_event_snapshot_does_not_drain_buffer() {
|
||||
let mut recorder = ProtocolEventRecorder::new(4);
|
||||
recorder.record_connected("Server");
|
||||
|
||||
let first = recorder.snapshot();
|
||||
let second = recorder.snapshot();
|
||||
let drained = recorder.drain();
|
||||
|
||||
assert_eq!(first, second);
|
||||
assert_eq!(drained, first);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user