mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-11-22 06:21:45 +03:00
replace tmpnam with something more suitable for the test files
This commit is contained in:
parent
ae8623a0a2
commit
01d7392a6a
@ -39,6 +39,17 @@ const char *test_choices_all_path = "test/data/Choices-all";
|
||||
const char *test_choices_full_path = "test/data/Choices-full";
|
||||
const char *test_choices_missing_path = "test/data/Choices-missing";
|
||||
|
||||
/**
|
||||
* generate test output filenames
|
||||
*/
|
||||
static char *testnam(char *out)
|
||||
{
|
||||
static int count = 0;
|
||||
static char name[64];
|
||||
snprintf(name, 64, "/tmp/nsoptiontest%d", count);
|
||||
count++;
|
||||
return name;
|
||||
}
|
||||
|
||||
static nserror gui_options_init_defaults(struct nsoption_s *defaults)
|
||||
{
|
||||
@ -160,7 +171,7 @@ START_TEST(nsoption_session_test)
|
||||
nsoption_set_colour(sys_colour_ActiveBorder, 0x00d0000d);
|
||||
|
||||
/* write options out */
|
||||
outnam = tmpnam(NULL);
|
||||
outnam = testnam(NULL);
|
||||
res = nsoption_write(outnam, NULL, NULL);
|
||||
ck_assert_int_eq(res, NSERROR_OK);
|
||||
|
||||
@ -300,7 +311,7 @@ START_TEST(nsoption_dump_test)
|
||||
res = nsoption_read(test_choices_path, NULL);
|
||||
ck_assert_int_eq(res, NSERROR_OK);
|
||||
|
||||
outnam = tmpnam(NULL);
|
||||
outnam = testnam(NULL);
|
||||
|
||||
fp = fopen(outnam, "w");
|
||||
res = nsoption_dump(fp, NULL);
|
||||
@ -325,7 +336,7 @@ START_TEST(nsoption_write_test)
|
||||
res = nsoption_read(test_choices_path, NULL);
|
||||
ck_assert_int_eq(res, NSERROR_OK);
|
||||
|
||||
outnam = tmpnam(NULL);
|
||||
outnam = testnam(NULL);
|
||||
|
||||
res = nsoption_write(outnam, NULL, NULL);
|
||||
ck_assert_int_eq(res, NSERROR_OK);
|
||||
|
@ -65,6 +65,18 @@ const char *wikipedia_url = "http://www.wikipedia.org/";
|
||||
|
||||
struct netsurf_table *guit = NULL;
|
||||
|
||||
/**
|
||||
* generate test output filenames
|
||||
*/
|
||||
static char *testnam(char *out)
|
||||
{
|
||||
static int count = 0;
|
||||
static char name[64];
|
||||
snprintf(name, 64, "/tmp/urldbtest%d", count);
|
||||
count++;
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* compare two files contents
|
||||
*/
|
||||
@ -443,7 +455,7 @@ START_TEST(urldb_session_test)
|
||||
urldb_load_cookies(test_cookies_path);
|
||||
|
||||
/* write database out */
|
||||
outnam = tmpnam(NULL);
|
||||
outnam = testnam(NULL);
|
||||
res = urldb_save(outnam);
|
||||
ck_assert_int_eq(res, NSERROR_OK);
|
||||
|
||||
@ -454,7 +466,7 @@ START_TEST(urldb_session_test)
|
||||
unlink(outnam);
|
||||
|
||||
/* write cookies out */
|
||||
outnam = tmpnam(NULL);
|
||||
outnam = testnam(NULL);
|
||||
urldb_save_cookies(outnam);
|
||||
|
||||
/* check for the correct answer */
|
||||
@ -500,7 +512,7 @@ START_TEST(urldb_session_add_test)
|
||||
nsurl_unref(url);
|
||||
|
||||
/* write database out */
|
||||
outnam = tmpnam(NULL);
|
||||
outnam = testnam(NULL);
|
||||
res = urldb_save(outnam);
|
||||
ck_assert_int_eq(res, NSERROR_OK);
|
||||
|
||||
@ -508,7 +520,7 @@ START_TEST(urldb_session_add_test)
|
||||
unlink(outnam);
|
||||
|
||||
/* write cookies out */
|
||||
outnam = tmpnam(NULL);
|
||||
outnam = testnam(NULL);
|
||||
urldb_save_cookies(outnam);
|
||||
|
||||
/* remove test output */
|
||||
|
Loading…
Reference in New Issue
Block a user