Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure to initialize buffers for logging testing. #233

Merged
merged 2 commits into from
Apr 16, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions test/test_logging_custom_env.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,15 @@ TEST(CLASSNAME(TestLoggingCustomEnv, RMW_IMPLEMENTATION), test_logging) {
rcutils_allocator_t allocator = rcutils_get_default_allocator();
rcutils_char_array_t msg_buf, output_buf;
ret = rcutils_char_array_init(&msg_buf, 1024, &allocator);
msg_buf.buffer[0] = '\0';
ret = rcutils_char_array_init(&output_buf, 1024, &allocator);
output_buf.buffer[0] = '\0';
rcutils_time_point_value_t now = 0;

ret = rcutils_logging_format_message(
NULL, RCUTILS_LOG_SEVERITY_FATAL, NULL, now, msg_buf.buffer, &output_buf);
EXPECT_EQ(RCUTILS_RET_OK, ret);

EXPECT_EQ(RCUTILS_RET_OK, rcutils_char_array_fini(&output_buf));
EXPECT_EQ(RCUTILS_RET_OK, rcutils_char_array_fini(&msg_buf));
}