Skip to content

Commit b604ba9

Browse files
committed
fix COPY test to handle quote properly
1 parent 1be27af commit b604ba9

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

src/client.rs

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2014,15 +2014,19 @@ mod tests {
20142014
F: 'a + FnOnce(Arc<Mutex<Session<MockStream>>>, &'a str, &'a str) -> K,
20152015
K: 'a + Future<Output = Result<T>>,
20162016
{
2017-
generic_with_uid(
2018-
"A0001 OK COPY completed\r\n",
2019-
"COPY",
2020-
"2:4",
2021-
"MEETING",
2022-
prefix,
2023-
op,
2024-
)
2025-
.await;
2017+
let resp = "A0001 OK COPY completed\r\n".as_bytes().to_vec();
2018+
let seq = "2:4";
2019+
let query = "MEETING";
2020+
let line = format!("A0001{prefix}COPY {seq} {}\r\n", quote!(query));
2021+
let session = Arc::new(Mutex::new(mock_session!(MockStream::new(resp))));
2022+
2023+
{
2024+
let _ = op(session.clone(), seq, query).await.unwrap();
2025+
}
2026+
assert!(
2027+
session.lock().await.stream.inner.written_buf == line.as_bytes().to_vec(),
2028+
"Invalid command"
2029+
);
20262030
}
20272031

20282032
#[cfg_attr(feature = "runtime-tokio", tokio::test)]

0 commit comments

Comments
 (0)