Skip to content

Commit

Permalink
format-json: test cases for allow spaces around = in key=value expr…
Browse files Browse the repository at this point in the history
…essions

Signed-off-by: Hofi <hofione@gmail.com>
  • Loading branch information
HofiOne committed Aug 29, 2024
1 parent 138496e commit f30f755
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions modules/json/tests/test_format_json.c
Original file line number Diff line number Diff line change
Expand Up @@ -458,3 +458,19 @@ Test(format_json, test_format_json_with_key_delimiter)
assert_template_format("$(format-json --key-delimiter ~ top~foo=1 top~bar=2 top~baz=3 top~sub~key1=val1 top~sub~key2=val2)",
"{\"top\":{\"sub\":{\"key2\":\"val2\",\"key1\":\"val1\"},\"foo\":\"1\",\"baz\":\"3\",\"bar\":\"2\"}}");
}

Test(format_json, test_format_json_key_value_with_spaces)
{
assert_template_format("$(format-json foo =alma)",
"{\"foo\":\"alma\"}");
assert_template_format("$(format-json foo= alma)",
"{\"foo\":\"alma\"}");
assert_template_format("$(format-json foo = alma)",
"{\"foo\":\"alma\"}");
assert_template_format("$(format-json foo=\" alma \")",
"{\"foo\":\" alma \"}");
assert_template_format("$(format-json foo= \" alma \")",
"{\"foo\":\" alma \"}");
assert_template_format("$(format-json foo1= alma foo2 =korte foo3 = szilva foo4 = \" meggy \")",
"{\"foo1\":\"alma\"},{\"foo2\":\"korte\"},{\"foo3\":\"szilva\"},{\"foo4\":\" meggy \"}");
}

0 comments on commit f30f755

Please sign in to comment.