Skip to content

Commit

Permalink
✅ zb: Check errors from fallible methods in e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
zeenix committed Jun 29, 2024
1 parent ab2cae9 commit 88b652c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion zbus/tests/e2e.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ impl MyIface {
}

/// Custom D-Bus error type.
#[derive(Debug, DBusError)]
#[derive(Debug, DBusError, PartialEq)]
#[zbus(prefix = "org.freedesktop.MyIface.Error")]
enum MyIfaceError {
SomethingWentWrong(String),
Expand Down Expand Up @@ -569,6 +569,13 @@ async fn my_iface_test(conn: Connection, event: Event) -> zbus::Result<u32> {
bar: "TestString".into(),
})
.await?;

proxy.test_error().await.unwrap_err();
assert_eq!(
proxy.test_custom_error().await.unwrap_err(),
MyIfaceError::SomethingWentWrong("oops".to_string())
);

check_hash_map(proxy.test_hashmap_return().await?);
check_hash_map(proxy.hash_map().await?);
proxy
Expand Down

0 comments on commit 88b652c

Please sign in to comment.