@@ -133,16 +133,15 @@ TEST_F(CLASSNAME(TestSubscriptionFixture, RMW_IMPLEMENTATION), test_subscription
133
133
rcl_ret_t ret = rcl_publisher_fini (&publisher, this ->node_ptr );
134
134
EXPECT_EQ (RCL_RET_OK, ret) << rcl_get_error_string ().str ;
135
135
});
136
- rcl_subscription_t subscription = rcl_get_zero_initialized_subscription ();
136
+
137
137
rcl_subscription_options_t subscription_options = rcl_subscription_get_default_options ();
138
+
139
+ rcl_subscription_t subscription = rcl_get_zero_initialized_subscription ();
138
140
ret = rcl_subscription_init (&subscription, this ->node_ptr , ts, topic, &subscription_options);
139
141
ASSERT_EQ (RCL_RET_OK, ret) << rcl_get_error_string ().str ;
140
- OSRF_TESTING_TOOLS_CPP_SCOPE_EXIT (
141
- {
142
- rcl_ret_t ret = rcl_subscription_fini (&subscription, this ->node_ptr );
143
- EXPECT_EQ (RCL_RET_OK, ret) << rcl_get_error_string ().str ;
144
- });
145
142
EXPECT_EQ (strcmp (rcl_subscription_get_topic_name (&subscription), expected_topic), 0 );
143
+ ret = rcl_subscription_fini (&subscription, this ->node_ptr );
144
+ EXPECT_EQ (RCL_RET_OK, ret) << rcl_get_error_string ().str ;
146
145
147
146
// Test is_valid for subscription with nullptr
148
147
EXPECT_FALSE (rcl_subscription_is_valid (nullptr ));
@@ -178,14 +177,15 @@ TEST_F(CLASSNAME(TestSubscriptionFixture, RMW_IMPLEMENTATION), test_subscription
178
177
{
179
178
test_msgs__msg__BasicTypes msg;
180
179
test_msgs__msg__BasicTypes__init (&msg);
181
- OSRF_TESTING_TOOLS_CPP_SCOPE_EXIT (
182
- {
183
- test_msgs__msg__BasicTypes__fini (&msg);
184
- });
180
+ OSRF_TESTING_TOOLS_CPP_SCOPE_EXIT ({
181
+ test_msgs__msg__BasicTypes__fini (&msg);
182
+ });
185
183
ret = rcl_take (&subscription, &msg, nullptr , nullptr );
186
184
ASSERT_EQ (RCL_RET_OK, ret) << rcl_get_error_string ().str ;
187
185
ASSERT_EQ (42 , msg.int64_value );
188
186
}
187
+ ret = rcl_subscription_fini (&subscription, this ->node_ptr );
188
+ EXPECT_EQ (RCL_RET_OK, ret) << rcl_get_error_string ().str ;
189
189
}
190
190
191
191
/* Basic nominal test of a publisher with a string.
0 commit comments