@@ -106,21 +106,55 @@ TEST(TypesupportHelpersTest, returns_service_type_info_for_valid_library) {
106106 }
107107}
108108
109+ TEST (TypesupportHelpersTest, returns_action_type_info_for_valid_legacy_library) {
110+ try {
111+ auto library = rclcpp::get_typesupport_library (
112+ " test_msgs/NestedMessage" , " rosidl_typesupport_cpp" );
113+ auto nestedmessage_typesupport = rclcpp::get_action_typesupport_handle (
114+ " test_msgs/NestedMessage" , " rosidl_typesupport_cpp" , *library);
115+
116+ EXPECT_THAT (
117+ std::string (nestedmessage_typesupport->goal_service_type_support ->typesupport_identifier ),
118+ ContainsRegex (" rosidl_typesupport" ));
119+ } catch (const std::runtime_error & e) {
120+ FAIL () << e.what ();
121+ }
122+ }
123+
124+ TEST (TypesupportHelpersTest, returns_action_type_info_for_valid_library) {
125+ try {
126+ auto library = rclcpp::get_typesupport_library (
127+ " test_msgs/action/NestedMessage" , " rosidl_typesupport_cpp" );
128+ auto nestedmessage_typesupport = rclcpp::get_action_typesupport_handle (
129+ " test_msgs/action/NestedMessage" , " rosidl_typesupport_cpp" , *library);
130+
131+ EXPECT_THAT (
132+ std::string (nestedmessage_typesupport->goal_service_type_support ->typesupport_identifier ),
133+ ContainsRegex (" rosidl_typesupport" ));
134+ } catch (const std::runtime_error & e) {
135+ FAIL () << e.what ();
136+ }
137+ }
138+
109139TEST (TypesupportHelpersTest, test_throw_exception_with_invalid_type) {
110140 // message
111141 std::string invalid_type = " test_msgs/msg/InvalidType" ;
112142 auto library = rclcpp::get_typesupport_library (invalid_type, " rosidl_typesupport_cpp" );
113143 EXPECT_THROW (
114144 rclcpp::get_message_typesupport_handle (invalid_type, " rosidl_typesupport_cpp" , *library),
115145 std::runtime_error);
116- EXPECT_THROW (
117- rclcpp::get_service_typesupport_handle (invalid_type, " rosidl_typesupport_cpp" , *library),
118- std::runtime_error);
119146
120147 // service
121148 invalid_type = " test_msgs/srv/InvalidType" ;
122149 library = rclcpp::get_typesupport_library (invalid_type, " rosidl_typesupport_cpp" );
123150 EXPECT_THROW (
124151 rclcpp::get_service_typesupport_handle (invalid_type, " rosidl_typesupport_cpp" , *library),
125152 std::runtime_error);
153+
154+ // action
155+ invalid_type = " test_msgs/action/InvalidType" ;
156+ library = rclcpp::get_typesupport_library (invalid_type, " rosidl_typesupport_cpp" );
157+ EXPECT_THROW (
158+ rclcpp::get_action_typesupport_handle (invalid_type, " rosidl_typesupport_cpp" , *library),
159+ std::runtime_error);
126160}
0 commit comments