assert!(logger.get_recording(1, &mut yenc_buffer).is_ok());
}
+// Verifies that Logger::list_recordings() shows an empty listing
+// if there are no recordings.
+#[test]
+fn list_recordings0() {
+ let pipe = Pipe::new();
+
+ let mut file = unsafe { std::fs::File::from_raw_fd(pipe.write_fd()) };
+
+ let mut ls_buffer_space = [0u8; 4096];
+ let mut ls_buffer = Buffer::alloc();
+
+ let user_data = (&mut file as *mut std::fs::File) as *mut BufferUserData;
+
+ ls_buffer.init(ls_buffer_space.as_mut_ptr(),
+ ls_buffer_space.len(),
+ flush_write_buffer,
+ user_data);
+
+ let mut fake_storage = FakeStorage::new();
+
+ let mut logger = Logger::new(&mut fake_storage);
+ logger.init();
+
+ logger.list_recordings(&mut ls_buffer);
+
+ let mut file = unsafe { std::fs::File::from_raw_fd(pipe.read_fd()) };
+
+ let mut listing_raw = [0u8; 256];
+
+ // There are no recordings, so there's no data in the pipe either.
+ assert!(file.read(&mut listing_raw).is_err());
+}
+
// Verifies that Logger::list_recordings() shows a listing
// of a single recording in the very first sector.
#[test]