Allow empty strings if they are quoted. (#450)
Signed-off-by: Ralf Anton Beier <ralf_beier@me.com>
This commit is contained in:
parent
9566f39d60
commit
5f0d331712
3 changed files with 32 additions and 1 deletions
|
@ -172,6 +172,25 @@ TEST(test_file_parser, max_string_sz) {
|
|||
allocator.deallocate(path, allocator.state);
|
||||
}
|
||||
|
||||
TEST(test_file_parser, empty_string) {
|
||||
rcutils_reset_error();
|
||||
EXPECT_TRUE(rcutils_get_cwd(cur_dir, 1024));
|
||||
rcutils_allocator_t allocator = rcutils_get_default_allocator();
|
||||
char * test_path = rcutils_join_path(cur_dir, "test", allocator);
|
||||
char * path = rcutils_join_path(test_path, "empty_string.yaml", allocator);
|
||||
fprintf(stderr, "cur_path: %s\n", path);
|
||||
EXPECT_TRUE(rcutils_exists(path));
|
||||
rcl_params_t * params_hdl = rcl_yaml_node_struct_init(allocator);
|
||||
EXPECT_FALSE(NULL == params_hdl);
|
||||
bool res = rcl_parse_yaml_file(path, params_hdl);
|
||||
fprintf(stderr, "%s\n", rcutils_get_error_string().str);
|
||||
EXPECT_TRUE(res);
|
||||
rcl_yaml_node_struct_print(params_hdl);
|
||||
rcl_yaml_node_struct_fini(params_hdl);
|
||||
allocator.deallocate(test_path, allocator.state);
|
||||
allocator.deallocate(path, allocator.state);
|
||||
}
|
||||
|
||||
TEST(test_file_parser, no_value1) {
|
||||
rcutils_reset_error();
|
||||
EXPECT_TRUE(rcutils_get_cwd(cur_dir, 1024));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue