mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-12-30 05:11:13 +00:00
Add a couple of regression tests for encoding
This commit is contained in:
parent
7c70445e3d
commit
742946a66a
@ -15,3 +15,14 @@ pub fn execute(buf: &mut Vec<u8>, portal: &str, limit: i32) {
|
||||
// limit
|
||||
buf.extend_from_slice(&limit.to_be_bytes());
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#[test]
|
||||
fn it_encodes_execute() {
|
||||
let mut buf = Vec::new();
|
||||
super::execute(&mut buf, "", 0);
|
||||
|
||||
assert_eq!(&*buf, b"E\0\0\0\t\0\0\0\0\0");
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,3 +5,14 @@ pub fn sync(buf: &mut Vec<u8>) {
|
||||
buf.push(b'S');
|
||||
buf.extend_from_slice(&4_i32.to_be_bytes());
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#[test]
|
||||
fn it_encodes_sync() {
|
||||
let mut buf = Vec::new();
|
||||
super::sync(&mut buf);
|
||||
|
||||
assert_eq!(&*buf, b"S\0\0\0\x04");
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user