Accept quoted int or float values as strings (#464)
Signed-off-by: ivanpauno <ivanpauno@ekumenlabs.com>
This commit is contained in:
parent
b6f4bc97fa
commit
d6ab086b02
3 changed files with 57 additions and 25 deletions
|
@ -22,7 +22,6 @@
|
|||
#include "rcutils/filesystem.h"
|
||||
|
||||
static char cur_dir[1024];
|
||||
rcutils_allocator_t allocator = rcutils_get_default_allocator();
|
||||
|
||||
TEST(test_file_parser, correct_syntax) {
|
||||
rcutils_reset_error();
|
||||
|
@ -43,6 +42,27 @@ TEST(test_file_parser, correct_syntax) {
|
|||
allocator.deallocate(path, allocator.state);
|
||||
}
|
||||
|
||||
TEST(test_file_parser, string_array_with_quoted_number) {
|
||||
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, "string_array_with_quoted_number.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_TRUE(params_hdl);
|
||||
if (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, multi_ns_correct_syntax) {
|
||||
rcutils_reset_error();
|
||||
EXPECT_TRUE(rcutils_get_cwd(cur_dir, 1024));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue