Add a missing [cfg(test)]

We don't always need to compile tests.
This commit is contained in:
Dmitry Ivanov
2021-07-22 16:30:57 +03:00
parent 97329d4906
commit 8b656bad5f
2 changed files with 7 additions and 2 deletions

View File

@@ -229,14 +229,17 @@ impl ReplicationConn {
}
}
#[cfg(test)]
mod tests {
use super::*;
// A no-op impl for tests
impl super::HsFeedbackSubscriber for () {}
impl HsFeedbackSubscriber for () {}
#[test]
fn test_replication_conn_background_thread_eof() {
// Test that background_thread recognizes EOF
let stream: &[u8] = &[];
super::ReplicationConn::background_thread(stream, ()).unwrap();
ReplicationConn::background_thread(stream, ()).unwrap();
}
}

View File

@@ -88,9 +88,11 @@ impl FeMessage {
/// ```
/// # use std::io::Read;
/// # use zenith_utils::pq_proto::FeMessage;
/// #
/// # fn process_message(msg: FeMessage) -> anyhow::Result<()> {
/// # Ok(())
/// # };
/// #
/// fn do_the_job(stream: &mut impl Read) -> anyhow::Result<()> {
/// while let Some(msg) = FeMessage::read(stream)? {
/// process_message(msg)?;