MpvError: add copy of command for better context
Build and test / test (push) Successful in 2m13s
Build and test / build (push) Successful in 10m26s
Build and test / docs (push) Successful in 11m19s
Build and test / check (push) Successful in 10m27s

This commit is contained in:
2024-12-12 16:26:44 +01:00
parent b2a22a9a57
commit 81479d2f64
5 changed files with 44 additions and 24 deletions
+2 -2
View File
@@ -151,8 +151,8 @@ async fn test_get_property_simultaneous_requests() {
tokio::time::sleep(Duration::from_millis(2)).await;
let maybe_volume = mpv_clone_3.get_property::<f64>("nonexistent").await;
match maybe_volume {
Err(MpvError::MpvError(err)) => {
assert_eq!(err, "property not found");
Err(MpvError::MpvError { message, .. }) => {
assert_eq!(message, "property not found");
}
_ => panic!("Unexpected result: {:?}", maybe_volume),
}
+14 -12
View File
@@ -63,12 +63,12 @@ async fn test_set_property_wrong_type() -> Result<(), MpvError> {
let mpv = Mpv::connect_socket(server).await?;
let maybe_volume = mpv.set_property::<bool>("volume", true).await;
assert_eq!(
maybe_volume,
Err(MpvError::MpvError(
"unsupported format for accessing property".to_string()
))
);
match maybe_volume {
Err(MpvError::MpvError { message, .. }) => {
assert_eq!(message, "unsupported format for accessing property");
}
_ => panic!("Unexpected result: {:?}", maybe_volume),
}
join_handle.await.unwrap().unwrap();
@@ -84,10 +84,12 @@ async fn test_get_property_error() -> Result<(), MpvError> {
let mpv = Mpv::connect_socket(server).await?;
let maybe_volume = mpv.set_property("nonexistent", true).await;
assert_eq!(
maybe_volume,
Err(MpvError::MpvError("property not found".to_string()))
);
match maybe_volume {
Err(MpvError::MpvError { message, .. }) => {
assert_eq!(message, "property not found");
}
_ => panic!("Unexpected result: {:?}", maybe_volume),
}
join_handle.await.unwrap().unwrap();
@@ -161,8 +163,8 @@ async fn test_set_property_simultaneous_requests() {
tokio::time::sleep(Duration::from_millis(2)).await;
let maybe_volume = mpv_clone_3.set_property("nonexistent", "a").await;
match maybe_volume {
Err(MpvError::MpvError(err)) => {
assert_eq!(err, "property not found");
Err(MpvError::MpvError { message, .. }) => {
assert_eq!(message, "property not found");
}
_ => panic!("Unexpected result: {:?}", maybe_volume),
}