Skip to content

Commit

Permalink
Add regression test for node:__ns remapping (#263)
Browse files Browse the repository at this point in the history
* Add regression test for node:__ns remapping

* Fix node:=__ns remapping

* Finalize node in remap integration test
  • Loading branch information
dhood authored and wjwwood committed Jul 16, 2018
1 parent 0ed0581 commit c21a250
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion rcl/src/rcl/node.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ rcl_node_init(
}
char * remapped_namespace = NULL;
ret = rcl_remap_node_namespace(
&(node->impl->options.arguments), global_args, local_namespace_,
&(node->impl->options.arguments), global_args, name,
*allocator, &remapped_namespace);
if (RCL_RET_OK != ret) {
goto fail;
Expand Down
16 changes: 16 additions & 0 deletions rcl/test/rcl/test_remap_integration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,3 +288,19 @@ TEST_F(CLASSNAME(TestRemapIntegrationFixture, RMW_IMPLEMENTATION), remap_relativ

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));
}

0 comments on commit c21a250

Please sign in to comment.