testsuite: Improve test-css-parser

Make it so that --generate parse produces output that can be
directly pasted into the ref.css file.
This commit is contained in:
Matthias Clasen 2024-05-13 09:54:57 -04:00
parent a96dd2ad0a
commit 76299396cf

View File

@ -269,6 +269,17 @@ add_tests_for_files_in_directory (GFile *dir)
int int
main (int argc, char **argv) main (int argc, char **argv)
{ {
if (argc >= 2 && strcmp (argv[1], "--generate") == 0)
{
GFile *file;
file = g_file_new_for_commandline_arg (argv[2]);
parse_css_file (file, TRUE);
g_object_unref (file);
return 0;
}
gtk_test_init (&argc, &argv); gtk_test_init (&argc, &argv);
if (argc < 2) if (argc < 2)
@ -282,27 +293,14 @@ main (int argc, char **argv)
g_object_unref (dir); g_object_unref (dir);
} }
else if (strcmp (argv[1], "--generate") == 0)
{
if (argc >= 3)
{
GFile *file = g_file_new_for_commandline_arg (argv[2]);
parse_css_file (file, TRUE);
g_object_unref (file);
}
}
else else
{ {
guint i; for (guint i = 1; i < argc; i++)
for (i = 1; i < argc; i++)
{ {
GFile *file = g_file_new_for_commandline_arg (argv[i]); GFile *file;
file = g_file_new_for_commandline_arg (argv[i]);
add_test_for_file (file); add_test_for_file (file);
g_object_unref (file); g_object_unref (file);
} }
} }