efl/efreet: formatting tests

SVN revision: 82780
This commit is contained in:
Lucas De Marchi 2013-01-14 21:04:30 +00:00
parent 2d7e10363d
commit 1a4535b5ff
10 changed files with 1396 additions and 1396 deletions

View File

@ -7,7 +7,40 @@
#include <limits.h>
#include "ef_test.h"
static void *_cb_command(void *data, Efreet_Desktop *desktop, char *exec, int remaining);
typedef struct
{
Eina_List *expected;
int error;
char type;
} Test_Info;
static void *
_cb_command(void *data, Efreet_Desktop *desktop EINA_UNUSED,
char *exec, int remaining EINA_UNUSED)
{
Test_Info *info = data;
char *expected;
expected = eina_list_data_get(info->expected);
info->expected = eina_list_demote_list(info->expected, info->expected);
if (!expected)
{
printf(" ERROR: (%%%c) got \"%s\", expected nothing\n",
info->type, exec);
info->error++;
}
else
{
if (strcmp(exec, expected))
{
printf(" ERROR: (%%%c) got \"%s\", expected \"%s\"\n",
info->type, exec, expected);
info->error++;
}
}
free(exec);
return NULL;
}
int
@ -150,8 +183,10 @@ ef_cb_desktop_save(void)
desktop->generic_name = strdup("Test Application");
desktop->exec = strdup("efreet_test");
desktop->categories = NULL;
desktop->categories = eina_list_append(desktop->categories, eina_stringshare_add("Test"));
desktop->categories = eina_list_append(desktop->categories, eina_stringshare_add("Enlightenment"));
desktop->categories = eina_list_append(desktop->categories,
eina_stringshare_add("Test"));
desktop->categories = eina_list_append(desktop->categories,
eina_stringshare_add("Enlightenment"));
printf("save test: %d\n", efreet_desktop_save(desktop));
unlink("/tmp/test.desktop");
efreet_desktop_free(desktop);
@ -159,13 +194,6 @@ ef_cb_desktop_save(void)
return 1;
}
typedef struct
{
Eina_List *expected;
int error;
char type;
} Test_Info;
int
ef_cb_desktop_command_get(void)
{
@ -337,32 +365,6 @@ ef_cb_desktop_command_get(void)
return ret;
}
static void *
_cb_command(void *data, Efreet_Desktop *desktop EINA_UNUSED,
char *exec, int remaining EINA_UNUSED)
{
Test_Info *info = data;
char *expected;
expected = eina_list_data_get(info->expected);
info->expected = eina_list_demote_list(info->expected, info->expected);
if (!expected)
{
printf(" ERROR: (%%%c) got \"%s\", expected nothing\n", info->type, exec);
info->error++;
}
else
{
if (strcmp(exec, expected))
{
printf(" ERROR: (%%%c) got \"%s\", expected \"%s\"\n", info->type, exec, expected);
info->error++;
}
}
free(exec);
return NULL;
}
static void *
cb_type_parse(Efreet_Desktop *desktop EINA_UNUSED, Efreet_Ini *ini)
{

View File

@ -24,7 +24,7 @@ ef_mime_cb_get(void)
{"entry.png", "image/png"},
{"entry", "image/png"},
{"sub", "inode/directory"},
{NULL, NULL}
{ }
};
double start;

View File

@ -122,9 +122,7 @@ main(int argc, char ** argv)
(!strcmp(argv[i], "--help")))
{
for (i = 0; tests[i].name; i++)
{
printf("%s\n", tests[i].name);
}
return 1;
}
run = eina_list_append(run, argv[i]);