Navigation Menu

Skip to content

Commit

Permalink
structure: add tests of deserializing strings with escapes
Browse files Browse the repository at this point in the history
  • Loading branch information
cxw42 authored and thiblahute committed Jan 19, 2021
1 parent 5eba2b8 commit 9d2825c
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/check/gst/gststructure.c
Expand Up @@ -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);
Expand Down

0 comments on commit 9d2825c

Please sign in to comment.