summaryrefslogtreecommitdiff
path: root/test/nsoption.c
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2017-03-09 22:11:55 +0000
committerVincent Sanders <vince@kyllikki.org>2017-03-09 22:11:55 +0000
commit01d7392a6acd6d077df52e2eaebd80576690cb36 (patch)
tree248dda7bf78a5fc20af930d89fec97319bc054e5 /test/nsoption.c
parentae8623a0a23730defc25468a21c25ac8b8eb3cd0 (diff)
downloadnetsurf-01d7392a6acd6d077df52e2eaebd80576690cb36.tar.gz
netsurf-01d7392a6acd6d077df52e2eaebd80576690cb36.tar.bz2
replace tmpnam with something more suitable for the test files
Diffstat (limited to 'test/nsoption.c')
-rw-r--r--test/nsoption.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/test/nsoption.c b/test/nsoption.c
index 3b75ca750..5874c94b6 100644
--- a/test/nsoption.c
+++ b/test/nsoption.c
@@ -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);