Add regression test for node:__ns remapping (#263)

* Add regression test for node:__ns remapping

* Fix node:=__ns remapping

* Finalize node in remap integration test
This commit is contained in:
dhood 2018-07-17 08:18:23 +10:00 committed by William Woodall
parent 0ed0581c44
commit c21a250a06
2 changed files with 17 additions and 1 deletions

View file

@ -244,7 +244,7 @@ rcl_node_init(
} }
char * remapped_namespace = NULL; char * remapped_namespace = NULL;
ret = rcl_remap_node_namespace( ret = rcl_remap_node_namespace(
&(node->impl->options.arguments), global_args, local_namespace_, &(node->impl->options.arguments), global_args, name,
*allocator, &remapped_namespace); *allocator, &remapped_namespace);
if (RCL_RET_OK != ret) { if (RCL_RET_OK != ret) {
goto fail; goto fail;

View file

@ -288,3 +288,19 @@ TEST_F(CLASSNAME(TestRemapIntegrationFixture, RMW_IMPLEMENTATION), remap_relativ
EXPECT_EQ(RCL_RET_OK, rcl_node_fini(&node)); EXPECT_EQ(RCL_RET_OK, rcl_node_fini(&node));
} }
TEST_F(CLASSNAME(TestRemapIntegrationFixture, RMW_IMPLEMENTATION), remap_using_node_rules) {
int argc;
char ** argv;
SCOPE_GLOBAL_ARGS(
argc, argv, "process_name", "original_name:__ns:=/new_ns");
rcl_node_t node = rcl_get_zero_initialized_node();
rcl_node_options_t default_options = rcl_node_get_default_options();
ASSERT_EQ(RCL_RET_OK, rcl_node_init(&node, "original_name", "", &default_options));
{ // Node namespace gets remapped
EXPECT_STREQ("/new_ns", rcl_node_get_namespace(&node));
}
EXPECT_EQ(RCL_RET_OK, rcl_node_fini(&node));
}