Fix mem leaks in unit test from 776 (#779)
Signed-off-by: Stephen Brawner <brawner@gmail.com>
This commit is contained in:
parent
bf2029acf8
commit
a34c4816c9
2 changed files with 34 additions and 17 deletions
|
@ -313,9 +313,12 @@ TEST(test_file_parser, seq_map1) {
|
|||
ASSERT_TRUE(rcutils_exists(path)) << "No test YAML file found at " << path;
|
||||
rcl_params_t * params_hdl = rcl_yaml_node_struct_init(allocator);
|
||||
ASSERT_TRUE(NULL != params_hdl) << rcutils_get_error_string().str;
|
||||
OSRF_TESTING_TOOLS_CPP_SCOPE_EXIT(
|
||||
{
|
||||
rcl_yaml_node_struct_fini(params_hdl);
|
||||
});
|
||||
bool res = rcl_parse_yaml_file(path, params_hdl);
|
||||
EXPECT_FALSE(res);
|
||||
// No cleanup, rcl_parse_yaml_file takes care of that if it fails.
|
||||
}
|
||||
|
||||
TEST(test_file_parser, seq_map2) {
|
||||
|
@ -337,9 +340,12 @@ TEST(test_file_parser, seq_map2) {
|
|||
ASSERT_TRUE(rcutils_exists(path)) << "No test YAML file found at " << path;
|
||||
rcl_params_t * params_hdl = rcl_yaml_node_struct_init(allocator);
|
||||
ASSERT_TRUE(NULL != params_hdl) << rcutils_get_error_string().str;
|
||||
OSRF_TESTING_TOOLS_CPP_SCOPE_EXIT(
|
||||
{
|
||||
rcl_yaml_node_struct_fini(params_hdl);
|
||||
});
|
||||
bool res = rcl_parse_yaml_file(path, params_hdl);
|
||||
EXPECT_FALSE(res);
|
||||
// No cleanup, rcl_parse_yaml_file takes care of that if it fails
|
||||
}
|
||||
|
||||
TEST(test_file_parser, params_with_no_node) {
|
||||
|
@ -361,9 +367,12 @@ TEST(test_file_parser, params_with_no_node) {
|
|||
ASSERT_TRUE(rcutils_exists(path)) << "No test YAML file found at " << path;
|
||||
rcl_params_t * params_hdl = rcl_yaml_node_struct_init(allocator);
|
||||
ASSERT_TRUE(NULL != params_hdl) << rcutils_get_error_string().str;
|
||||
OSRF_TESTING_TOOLS_CPP_SCOPE_EXIT(
|
||||
{
|
||||
rcl_yaml_node_struct_fini(params_hdl);
|
||||
});
|
||||
bool res = rcl_parse_yaml_file(path, params_hdl);
|
||||
EXPECT_FALSE(res);
|
||||
// No cleanup, rcl_parse_yaml_file takes care of that if it fails.
|
||||
}
|
||||
|
||||
TEST(test_file_parser, no_alias_support) {
|
||||
|
@ -385,9 +394,12 @@ TEST(test_file_parser, no_alias_support) {
|
|||
ASSERT_TRUE(rcutils_exists(path)) << "No test YAML file found at " << path;
|
||||
rcl_params_t * params_hdl = rcl_yaml_node_struct_init(allocator);
|
||||
ASSERT_TRUE(NULL != params_hdl) << rcutils_get_error_string().str;
|
||||
OSRF_TESTING_TOOLS_CPP_SCOPE_EXIT(
|
||||
{
|
||||
rcl_yaml_node_struct_fini(params_hdl);
|
||||
});
|
||||
bool res = rcl_parse_yaml_file(path, params_hdl);
|
||||
EXPECT_FALSE(res);
|
||||
// No cleanup, rcl_parse_yaml_file takes care of that if it fails.
|
||||
}
|
||||
|
||||
TEST(test_file_parser, empty_string) {
|
||||
|
@ -437,9 +449,12 @@ TEST(test_file_parser, no_value1) {
|
|||
ASSERT_TRUE(rcutils_exists(path)) << "No test YAML file found at " << path;
|
||||
rcl_params_t * params_hdl = rcl_yaml_node_struct_init(allocator);
|
||||
ASSERT_TRUE(NULL != params_hdl) << rcutils_get_error_string().str;
|
||||
OSRF_TESTING_TOOLS_CPP_SCOPE_EXIT(
|
||||
{
|
||||
rcl_yaml_node_struct_fini(params_hdl);
|
||||
});
|
||||
bool res = rcl_parse_yaml_file(path, params_hdl);
|
||||
EXPECT_FALSE(res);
|
||||
// No cleanup, rcl_parse_yaml_file takes care of that if it fails.
|
||||
}
|
||||
|
||||
TEST(test_file_parser, indented_ns) {
|
||||
|
@ -461,9 +476,12 @@ TEST(test_file_parser, indented_ns) {
|
|||
ASSERT_TRUE(rcutils_exists(path)) << "No test YAML file found at " << path;
|
||||
rcl_params_t * params_hdl = rcl_yaml_node_struct_init(allocator);
|
||||
ASSERT_TRUE(NULL != params_hdl) << rcutils_get_error_string().str;
|
||||
OSRF_TESTING_TOOLS_CPP_SCOPE_EXIT(
|
||||
{
|
||||
rcl_yaml_node_struct_fini(params_hdl);
|
||||
});
|
||||
bool res = rcl_parse_yaml_file(path, params_hdl);
|
||||
EXPECT_FALSE(res);
|
||||
// No cleanup, rcl_parse_yaml_file takes care of that if it fails.
|
||||
}
|
||||
|
||||
// Regression test for https://github.com/ros2/rcl/issues/419
|
||||
|
@ -486,9 +504,12 @@ TEST(test_file_parser, maximum_number_parameters) {
|
|||
ASSERT_TRUE(rcutils_exists(path)) << "No test YAML file found at " << path;
|
||||
rcl_params_t * params_hdl = rcl_yaml_node_struct_init(allocator);
|
||||
ASSERT_TRUE(NULL != params_hdl) << rcutils_get_error_string().str;
|
||||
OSRF_TESTING_TOOLS_CPP_SCOPE_EXIT(
|
||||
{
|
||||
rcl_yaml_node_struct_fini(params_hdl);
|
||||
});
|
||||
bool res = rcl_parse_yaml_file(path, params_hdl);
|
||||
EXPECT_FALSE(res);
|
||||
// No cleanup, rcl_parse_yaml_file takes care of that if it fails.
|
||||
}
|
||||
|
||||
// Test special float point(https://github.com/ros2/rcl/issues/555).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue