MakeSureDirectoryPathExists conformance test

Wolfgang Schwotzer wolfgang.schwotzer at gmx.net
Wed Sep 8 14:40:40 CDT 2004


This patch adds a conformance test for my patch
sent on 06. Sept 2004.

the new directory dlls/dbghelp/tests has to be
created and the files

dlls/dbghelp/tests/Makefile.in
dlls/dbghelp/tests/path.c

have to be added.
-------------- next part --------------
? dlls/dbghelp/tests
Index: configure.ac
===================================================================
RCS file: /home/wine/wine/configure.ac,v
retrieving revision 1.307
diff -u -u -r1.307 configure.ac
--- configure.ac	7 Sep 2004 22:44:34 -0000	1.307
+++ configure.ac	8 Sep 2004 18:43:39 -0000
@@ -1540,6 +1540,7 @@
 dlls/d3dx8/Makefile
 dlls/d3dxof/Makefile
 dlls/dbghelp/Makefile
+dlls/dbghelp/tests/Makefile
 dlls/dciman32/Makefile
 dlls/ddraw/Makefile
 dlls/ddraw/tests/Makefile
Index: dlls/dbghelp/Makefile.in
===================================================================
RCS file: /home/wine/wine/dlls/dbghelp/Makefile.in,v
retrieving revision 1.1
diff -u -u -r1.1 Makefile.in
--- dlls/dbghelp/Makefile.in	5 Apr 2004 22:21:27 -0000	1.1
+++ dlls/dbghelp/Makefile.in	8 Sep 2004 18:43:45 -0000
@@ -22,6 +22,8 @@
 	symbol.c \
 	type.c
 
+SUBDIRS   = tests
+
 @MAKE_DLL_RULES@
 
 ### Dependencies:
-------------- next part --------------
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ../../..
SRCDIR    = @srcdir@
VPATH     = @srcdir@
TESTDLL   = dbghelp.dll
IMPORTS   = dbghelp

CTESTS = \
        path.c

@MAKE_TEST_RULES@

### Dependencies:
-------------- next part --------------
/*
 * Unit test suite for dbghelp/path.c
 *
 * Copyright 2004 Wolfgang Schwotzer
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#include "wine/test.h"
#include <windows.h>
#include <dbghelp.h>

#define DIR1  "Directory1"
#define DIR2  "Directory2"
#define FILE1 "File.ext"

void test_MakeSureDirectoryPathExists(LPCSTR curdir)
{
   CHAR path[MAX_PATH];
   DWORD error = 0;
   DWORD attr;

   strcpy(path, curdir);
   strcat(path, "\\" DIR1 "\\" DIR2 "\\");
   SetLastError(0);
   ok(MakeSureDirectoryPathExists(path),
     "MakeSureDirectoryPathExists error=%ld\n", GetLastError());
   strcat(path, FILE1);
   SetLastError(0);
   ok(MakeSureDirectoryPathExists(path),
     "MakeSureDirectoryPathExists error=%ld\n", GetLastError());
   attr = GetFileAttributes(path);
   error = GetLastError();
   ok (attr == INVALID_FILE_ATTRIBUTES && (error == ERROR_FILE_NOT_FOUND),
     "MakeSureDirectoryPathExists should not create path=%s attr=%ld error=%ld\n", path, attr, error);

   /* do cleanup */
   RemoveDirectoryA(path);
   strcpy(path, curdir);
   strcat(path, "\\" DIR1 "\\" DIR2);
   RemoveDirectoryA(path);
   strcpy(path, curdir);
   strcat(path, "\\" DIR1);
   RemoveDirectoryA(path);
}

START_TEST(path)
{
   CHAR curdir[MAX_PATH];
   ok(GetCurrentDirectoryA(MAX_PATH, curdir) > 0,
     "Unable to get current directory, some tests will not be conducted");

   test_MakeSureDirectoryPathExists(curdir);
}



More information about the wine-patches mailing list