corrected missing shellerror type (#439)

This commit is contained in:
Fernando Herrera
2021-12-05 13:25:37 +00:00
committed by GitHub
parent 22469a9cb1
commit 29efbee285
17 changed files with 723 additions and 607 deletions

View File

@ -382,4 +382,25 @@ mod tests {
PluginResponse::Value(_) => panic!("returned wrong call type"),
}
}
#[test]
fn response_round_trip_error_none() {
let error = LabeledError {
label: "label".into(),
msg: "msg".into(),
span: None,
};
let response = PluginResponse::Error(error.clone());
let mut buffer: Vec<u8> = Vec::new();
encode_response(&response, &mut buffer).expect("unable to serialize message");
let returned =
decode_response(&mut buffer.as_slice()).expect("unable to deserialize message");
match returned {
PluginResponse::Error(msg) => assert_eq!(error, msg),
PluginResponse::Signature(_) => panic!("returned wrong call type"),
PluginResponse::Value(_) => panic!("returned wrong call type"),
}
}
}