//! What the command line's tests share: an output they can read back.
usestd::io::Write;usestd::sync::{Arc, Mutex};/// A shared buffer standing in for an output: clones write to the same bytes.
#[derive(Clone, Default)]pub(crate)structBuf(Arc<Mutex<Vec<u8>>>);implWrite forBuf{fnwrite(&mutself, b:&[u8])->std::io::Result<usize>{self.0.lock().unwrap().write(b)}fnflush(&mutself)->std::io::Result<()>{Ok(())}}implBuf{/// What was written since the last take.
pub(crate)fntake(&self)-> String{String::from_utf8(std::mem::take(&mut*self.0.lock().unwrap())).unwrap()}}