mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-25 21:46:14 +01:00
Add tests for --allow-any-name
This commit is contained in:
parent
0b61a87c29
commit
1c2aea7854
@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
const gchar *name;
|
const gchar *name;
|
||||||
|
const gchar *opt;
|
||||||
const gchar *stderr;
|
const gchar *stderr;
|
||||||
} SchemaTest;
|
} SchemaTest;
|
||||||
|
|
||||||
@ -23,6 +24,7 @@ test_schema (gpointer data)
|
|||||||
"../gschema-compile",
|
"../gschema-compile",
|
||||||
"--dry-run",
|
"--dry-run",
|
||||||
"--one-schema-file", path,
|
"--one-schema-file", path,
|
||||||
|
(gchar *)test->opt,
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
gchar *envp[] = { NULL };
|
gchar *envp[] = { NULL };
|
||||||
@ -30,22 +32,32 @@ test_schema (gpointer data)
|
|||||||
g_free (filename);
|
g_free (filename);
|
||||||
g_free (path);
|
g_free (path);
|
||||||
}
|
}
|
||||||
g_test_trap_assert_failed ();
|
if (test->stderr)
|
||||||
g_test_trap_assert_stderr (test->stderr);
|
{
|
||||||
|
g_test_trap_assert_failed ();
|
||||||
|
g_test_trap_assert_stderr (test->stderr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
g_test_trap_assert_passed();
|
||||||
}
|
}
|
||||||
|
|
||||||
static const SchemaTest tests[] = {
|
static const SchemaTest tests[] = {
|
||||||
{ "no-default", "*<default> is required in <key>*" },
|
{ "no-default", NULL, "*<default> is required in <key>*" },
|
||||||
{ "missing-quotes", "*unknown keyword*" },
|
{ "missing-quotes", NULL, "*unknown keyword*" },
|
||||||
{ "incomplete-list", "*to follow array element*" },
|
{ "incomplete-list", NULL, "*to follow array element*" },
|
||||||
{ "wrong-category", "*attribute 'l10n' invalid*" },
|
{ "wrong-category", NULL, "*attribute 'l10n' invalid*" },
|
||||||
{ "bad-type", "*invalid GVariant type string*" },
|
{ "bad-type", NULL, "*invalid GVariant type string*" },
|
||||||
{ "overflow", "*out of range*" },
|
{ "overflow", NULL, "*out of range*" },
|
||||||
{ "bad-key", "*invalid name*" },
|
{ "bad-key", NULL, "*invalid name*" },
|
||||||
{ "bad-key2", "*invalid name*" },
|
{ "bad-key", "--allow-any-name", NULL },
|
||||||
{ "bad-key3", "*invalid name*" },
|
{ "bad-key2", NULL, "*invalid name*" },
|
||||||
{ "bad-key4", "*invalid name*" },
|
{ "bad-key2", "--allow-any-name", NULL },
|
||||||
{ "empty-key", "*empty names*" },
|
{ "bad-key3", NULL, "*invalid name*" },
|
||||||
|
{ "bad-key3", "--allow-any-name", NULL },
|
||||||
|
{ "bad-key4", NULL, "*invalid name*" },
|
||||||
|
{ "bad-key4", "--allow-any-name", NULL },
|
||||||
|
{ "empty-key", NULL, "*empty names*" },
|
||||||
|
{ "empty-key", "--allow-any-name", "*empty names*" },
|
||||||
};
|
};
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -60,7 +72,7 @@ main (int argc, char *argv[])
|
|||||||
|
|
||||||
for (i = 0; i < G_N_ELEMENTS (tests); ++i)
|
for (i = 0; i < G_N_ELEMENTS (tests); ++i)
|
||||||
{
|
{
|
||||||
gchar *name = g_strdup_printf ("/gschema/%s", tests[i].name);
|
gchar *name = g_strdup_printf ("/gschema/%s%s", tests[i].name, tests[i].opt ? "/opt" : "");
|
||||||
g_test_add_data_func (name, &tests[i], (gpointer) test_schema);
|
g_test_add_data_func (name, &tests[i], (gpointer) test_schema);
|
||||||
g_free (name);
|
g_free (name);
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<schemalist>
|
<schemalist>
|
||||||
<schema id="no-default" path="/tests/">
|
<schema id="no-default" path="/tests/">
|
||||||
<key name="bad_key" type="s">
|
<key name="bad_key" type="s">
|
||||||
<default></default>
|
<default>''</default>
|
||||||
</key>
|
</key>
|
||||||
</schema>
|
</schema>
|
||||||
</schemalist>
|
</schemalist>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<schemalist>
|
<schemalist>
|
||||||
<schema id="no-default" path="/tests/">
|
<schema id="no-default" path="/tests/">
|
||||||
<key name="BAD-key" type="s">
|
<key name="BAD-key" type="s">
|
||||||
<default></default>
|
<default>''</default>
|
||||||
</key>
|
</key>
|
||||||
</schema>
|
</schema>
|
||||||
</schemalist>
|
</schemalist>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<schemalist>
|
<schemalist>
|
||||||
<schema id="no-default" path="/tests/">
|
<schema id="no-default" path="/tests/">
|
||||||
<key name="bad--key" type="s">
|
<key name="bad--key" type="s">
|
||||||
<default></default>
|
<default>''</default>
|
||||||
</key>
|
</key>
|
||||||
</schema>
|
</schema>
|
||||||
</schemalist>
|
</schemalist>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<schemalist>
|
<schemalist>
|
||||||
<schema id="no-default" path="/tests/">
|
<schema id="no-default" path="/tests/">
|
||||||
<key name="bad-key-" type="s">
|
<key name="bad-key-" type="s">
|
||||||
<default></default>
|
<default>''</default>
|
||||||
</key>
|
</key>
|
||||||
</schema>
|
</schema>
|
||||||
</schemalist>
|
</schemalist>
|
||||||
|
Loading…
Reference in New Issue
Block a user