test handling of trailing backslash in dlls/kernel/tests/path.c
Changelog: dlls/kernel/tests/path.c: test_InitPathA Test what happens when TMP variable has no trailing backslash A patch to correct that hbehaviour follows. -- Uwe Bonnes bon(a)elektron.ikp.physik.tu-darmstadt.de Free Software: If you contribute nothing, expect nothing -- Index: wine/dlls/kernel/tests/path.c =================================================================== RCS file: /home/wine/wine/dlls/kernel/tests/path.c,v retrieving revision 1.3 diff -u -r1.3 path.c --- wine/dlls/kernel/tests/path.c 6 May 2002 20:13:16 -0000 1.3 +++ wine/dlls/kernel/tests/path.c 9 May 2002 16:23:44 -0000 @@ -19,6 +19,7 @@ */ #include <stdio.h> +#include <assert.h> #include "wine/test.h" #include "winbase.h" #include "winuser.h" @@ -330,20 +331,22 @@ { CHAR tmppath[MAX_PATH], /*path to TEMP */ tmpstr[MAX_PATH], - tmpstr1[MAX_PATH]; + tmpstr1[MAX_PATH], + envstr[MAX_PATH]; DWORD len,len1; INT id; HANDLE hndl; /* Test GetTempPathA */ - len=GetTempPathA(MAX_PATH,tmppath); + len=GetTempPathA(0,tmppath); ok(len!=0 && len < MAX_PATH,"GetTempPathA failed"); + len1=GetTempPathA(len,tmppath); ok(HAS_TRAIL_SLASH_A(tmppath), "GetTempPathA returned a path that did not end in '\\'"); lstrcpyA(tmpstr,"aaaaaaaa"); len1=GetTempPathA(len,tmpstr); - ok(len1==len+1, - "GetTempPathA should return string length %d instead of %d",len+1,len1); + ok(len1+1==len, + "GetTempPathA should return string %s length %d instead of %d",tmpstr, len,len1+1); if(WIN2K_PLUS(version)) { /* in Win2k, the path won't be modified, but in win98, wine it is */ todo_wine { @@ -351,6 +354,20 @@ "GetTempPathA should not have modified the buffer"); } } + + /* Now set the TMP variable to GetTempPath without the trailing backslash + to test for completion of backslash */ + len1 = GetEnvironmentVariableA("TMP",envstr,MAX_PATH); + ok(len1< MAX_PATH, "TMP Envirinment Variable too long"); + tmppath[len-2] = '\0'; + ok(SetEnvironmentVariableA("TMP",tmppath),"SetEnvironmentVariable(\"TMP\") failed"); + len1=GetTempPathA(0,tmppath); + len1=GetTempPathA(len1,tmppath); + ok(HAS_TRAIL_SLASH_A(tmppath), + "GetTempPathA didn't correct a TMP setting without trailing '\\'"); + ok(SetEnvironmentVariableA("TMP",envstr),"Can't reset TMP environment variable"); + len1=GetTempPathA(len,tmppath); + /* Test GetTmpFileNameA The only test we do here is whether GetTempFileNameA passes or not. We do not thoroughly test this function yet (specifically, whether
participants (1)
-
Uwe Bonnes