diff --git a/src/subsystem/subsystem_handle.rs b/src/subsystem/subsystem_handle.rs index 02fa2d5..5539417 100644 --- a/src/subsystem/subsystem_handle.rs +++ b/src/subsystem/subsystem_handle.rs @@ -333,7 +333,7 @@ impl SubsystemHandle { /// /// Note that the names of nested subsystems are built unix-path alike, /// starting and delimited by slashes (e.g. `/a/b/c`). - /// + /// /// See [`SubsystemBuilder::new()`] how to set this name. pub fn name(&self) -> &str { &self.inner.name diff --git a/tests/integration_test.rs b/tests/integration_test.rs index e9ecfc9..3b8b7b2 100644 --- a/tests/integration_test.rs +++ b/tests/integration_test.rs @@ -924,13 +924,19 @@ async fn shutdown_through_signal() { #[tokio::test] #[traced_test] async fn access_name_from_within_subsystem() { - let subsys1 = move |subsys: SubsystemHandle| async move { - assert_eq!("/subsys", subsys.name()); + let subsys_nested = move |subsys: SubsystemHandle| async move { + assert_eq!("/subsys_top/subsys_nested", subsys.name()); + BoxedResult::Ok(()) + }; + + let subsys_top = move |subsys: SubsystemHandle| async move { + assert_eq!("/subsys_top", subsys.name()); + subsys.start(SubsystemBuilder::new("subsys_nested", subsys_nested)); BoxedResult::Ok(()) }; Toplevel::new(move |s| async move { - s.start(SubsystemBuilder::new("subsys", subsys1)); + s.start(SubsystemBuilder::new("subsys_top", subsys_top)); }) .handle_shutdown_requests(Duration::from_millis(100)) .await