From 98433bca4b016e9853e9232b46d6a1e4c945aeb4 Mon Sep 17 00:00:00 2001 From: Jacob Perron Date: Mon, 27 Jan 2020 09:48:20 -0800 Subject: [PATCH] Add regression test Signed-off-by: Jacob Perron --- rcl/test/rcl/test_arguments.cpp | 20 +++++++++++++++++++ .../test_malformed_parameters.1.yaml | 5 +++++ 2 files changed, 25 insertions(+) create mode 100644 rcl/test/resources/test_arguments/test_malformed_parameters.1.yaml diff --git a/rcl/test/rcl/test_arguments.cpp b/rcl/test/rcl/test_arguments.cpp index 0f8964069..e8f4f072e 100644 --- a/rcl/test/rcl/test_arguments.cpp +++ b/rcl/test/rcl/test_arguments.cpp @@ -897,6 +897,26 @@ TEST_F(CLASSNAME(TestArgumentsFixture, RMW_IMPLEMENTATION), test_deprecated_para EXPECT_EQ(1, *(param_value->integer_value)); } +// Regression test for https://github.com/ros2/rcl/issues/553 +// Testing behaviour that was broken in Eloquent +TEST_F( + CLASSNAME(TestArgumentsFixture, RMW_IMPLEMENTATION), test_deprecated_param_argument_malformed) +{ + const std::string parameters_filepath = (test_path / "test_malformed_parameters.1.yaml").string(); + const std::string parameter_rule = "__params:=" + parameters_filepath; + const char * argv[] = { + "process_name", parameter_rule.c_str() + }; + int argc = sizeof(argv) / sizeof(const char *); + rcl_ret_t ret; + + rcl_allocator_t alloc = rcl_get_default_allocator(); + rcl_arguments_t parsed_args = rcl_get_zero_initialized_arguments(); + + ret = rcl_parse_arguments(argc, argv, alloc, &parsed_args); + ASSERT_EQ(RCL_RET_ERROR, ret) << rcl_get_error_string().str; +} + TEST_F(CLASSNAME(TestArgumentsFixture, RMW_IMPLEMENTATION), test_param_argument_multiple) { const std::string parameters_filepath1 = (test_path / "test_parameters.1.yaml").string(); const std::string parameters_filepath2 = (test_path / "test_parameters.2.yaml").string(); diff --git a/rcl/test/resources/test_arguments/test_malformed_parameters.1.yaml b/rcl/test/resources/test_arguments/test_malformed_parameters.1.yaml new file mode 100644 index 000000000..257224a97 --- /dev/null +++ b/rcl/test/resources/test_arguments/test_malformed_parameters.1.yaml @@ -0,0 +1,5 @@ +some_node: + ros_parameters: + int_param: 1 + param_group: + string_param: foo