From 7b43f02ed329e76c30d8ce0db4a0561ff0692651 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 3 Jun 2011 13:25:54 +0200 Subject: [PATCH] structure: fix some more 0.11 fixmes don't allow spaces in structure names and fix unit tests. --- gst/gststructure.c | 3 +-- tests/check/gst/gststructure.c | 22 ++++------------------ 2 files changed, 5 insertions(+), 20 deletions(-) diff --git a/gst/gststructure.c b/gst/gststructure.c index 2793d5e..9f66bc9 100644 --- a/gst/gststructure.c +++ b/gst/gststructure.c @@ -171,10 +171,9 @@ gst_structure_validate_name (const gchar * name) return FALSE; } - /* FIXME 0.11: don't allow spaces */ /* FIXME: test name string more */ s = &name[1]; - while (*s && (g_ascii_isalnum (*s) || strchr ("/-_.:+ ", *s) != NULL)) + while (*s && (g_ascii_isalnum (*s) || strchr ("/-_.:+", *s) != NULL)) s++; if (G_UNLIKELY (*s != '\0')) { GST_WARNING ("Invalid character '%c' at offset %lu in structure name: %s", diff --git a/tests/check/gst/gststructure.c b/tests/check/gst/gststructure.c index 6e0e937..b19762a 100644 --- a/tests/check/gst/gststructure.c +++ b/tests/check/gst/gststructure.c @@ -159,11 +159,9 @@ GST_START_TEST (test_from_string) fail_unless_equals_int (g_value_get_boolean (val), TRUE); gst_structure_free (structure); - /* This should still work for now (FIXME: 0.11) */ s = "0.10:decoder-video/mpeg, abc=(boolean)false"; - structure = gst_structure_from_string (s, NULL); - fail_if (structure == NULL, "Could not get structure from string %s", s); - gst_structure_free (structure); + ASSERT_CRITICAL (structure = gst_structure_from_string (s, NULL)); + fail_unless (structure == NULL, "Could not get structure from string %s", s); /* make sure we bail out correctly in case of an error or if parsing fails */ s = "***foo***, abc=(boolean)false"; @@ -188,22 +186,10 @@ GST_START_TEST (test_to_string) ASSERT_CRITICAL (st1 = gst_structure_new ("Foo\nwith-newline", NULL)); fail_unless (st1 == NULL); - /* FIXME 0.11: re-enable this */ -#if 0 ASSERT_CRITICAL (st1 = gst_structure_new ("Foo with whitespace", NULL)); fail_unless (st1 == NULL); ASSERT_CRITICAL (st1 = gst_structure_new ("1st", NULL)); fail_unless (st1 == NULL); -#else - st1 = gst_structure_new ("Foo with whitespace is still allowed", NULL); - fail_unless (st1 != NULL); - gst_structure_free (st1); - - /* structure names starting with a number are also still allowed */ - st1 = gst_structure_new ("1st", NULL); - fail_unless (st1 != NULL); - gst_structure_free (st1); -#endif } GST_END_TEST; @@ -339,8 +325,8 @@ GST_START_TEST (test_structure_new) g_error_free (e); gst_structure_free (s); - /* This should still work for now (FIXME 0.11) */ - gst_structure_free (gst_structure_new ("0.10:decoder-video/mpeg", NULL)); + ASSERT_CRITICAL (gst_structure_free (gst_structure_new + ("0.10:decoder-video/mpeg", NULL))); /* make sure we bail out correctly in case of an error or if parsing fails */ ASSERT_CRITICAL (s = gst_structure_new ("^joo\nba\ndoo^", -- 2.7.4