apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@apache.org
Subject cvs commit: apr/test testtemp.c
Date Fri, 19 Mar 2004 02:22:31 GMT
rbb         2004/03/18 18:22:31

  Modified:    test     testtemp.c
  Log:
  Add a test for apr_mktemp
  
  Revision  Changes    Path
  1.2       +17 -0     apr/test/testtemp.c
  
  Index: testtemp.c
  ===================================================================
  RCS file: /home/cvs/apr/test/testtemp.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- testtemp.c	18 Mar 2004 17:46:02 -0000	1.1
  +++ testtemp.c	19 Mar 2004 02:22:31 -0000	1.2
  @@ -15,6 +15,7 @@
   
   #include "test_apr.h"
   #include "apr_file_io.h"
  +#include "apr_strings.h"
   
   static void test_temp_dir(CuTest *tc)
   {
  @@ -26,11 +27,27 @@
       CuAssertPtrNotNull(tc, tempdir);
   }
   
  +static void test_mktemp(CuTest *tc)
  +{
  +    apr_file_t *f = NULL;
  +    const char *tempdir = NULL;
  +    char *filetemplate;
  +    apr_status_t rv;
  +
  +    rv = apr_temp_dir_get(&tempdir, p);
  +    apr_assert_success(tc, "Error finding Temporary Directory", rv);
  +    
  +    filetemplate = apr_pstrcat(p, tempdir, "/tempfileXXXXXX", NULL);
  +    rv = apr_file_mktemp(&f, filetemplate, 0, p);
  +    apr_assert_success(tc, "Error opening Temporary file", rv);
  +}
  +
   CuSuite *testtemp(void)
   {
       CuSuite *suite = CuSuiteNew("Temp Dir");
   
       SUITE_ADD_TEST(suite, test_temp_dir);
  +    SUITE_ADD_TEST(suite, test_mktemp);
   
       return suite;
   }
  
  
  

Mime
View raw message