mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 22:36:33 +00:00
structure: add tests of deserializing strings with escapes
Shows the issue described in <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/303#note_272629> Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/303>
This commit is contained in:
parent
5eba2b83b7
commit
9d2825ccff
1 changed files with 15 additions and 0 deletions
|
@ -223,6 +223,21 @@ GST_START_TEST (test_from_string)
|
|||
ASSERT_CRITICAL (structure = gst_structure_from_string (s, NULL));
|
||||
fail_unless (structure == NULL, "Could not get structure from string %s", s);
|
||||
|
||||
/* Test that escaping works both with and without a type */
|
||||
s = "foo/bar, value=\"raven \\\"nevermore\\\"\"";
|
||||
structure = gst_structure_from_string (s, NULL);
|
||||
fail_if (structure == NULL, "Could not get structure from string %s", s);
|
||||
fail_unless ((val = gst_structure_get_value (structure, "value")) != NULL);
|
||||
fail_unless (G_VALUE_HOLDS_STRING (val));
|
||||
gst_structure_free (structure);
|
||||
|
||||
s = "foo/bar, value=(string)\"raven \\\"nevermore\\\"\"";
|
||||
structure = gst_structure_from_string (s, NULL);
|
||||
fail_if (structure == NULL, "Could not get structure from string %s", s);
|
||||
fail_unless ((val = gst_structure_get_value (structure, "value")) != NULL);
|
||||
fail_unless (G_VALUE_HOLDS_STRING (val));
|
||||
gst_structure_free (structure);
|
||||
|
||||
/* make sure we bail out correctly in case of an error or if parsing fails */
|
||||
s = "***foo***, abc=(boolean)false";
|
||||
structure = gst_structure_from_string (s, NULL);
|
||||
|
|
Loading…
Reference in a new issue