Module: wine Branch: master Commit: a79868e09d0f45d36f714a9adce2a517925ae017 URL: http://source.winehq.org/git/wine.git/?a=commit;h=a79868e09d0f45d36f714a9adc...
Author: Alexandre Julliard julliard@winehq.org Date: Tue Jan 27 14:49:47 2009 +0100
kernel32/tests: Don't hardcode C drive for SetCurrentDirectory tests.
Also handle the case where TMP and TEMP are not defined.
---
dlls/kernel32/tests/path.c | 26 ++++++++++++++++---------- 1 files changed, 16 insertions(+), 10 deletions(-)
diff --git a/dlls/kernel32/tests/path.c b/dlls/kernel32/tests/path.c index e8e6c1e..3985bcf 100644 --- a/dlls/kernel32/tests/path.c +++ b/dlls/kernel32/tests/path.c @@ -468,10 +468,10 @@ static void test_CurrentDirectoryA(CHAR *origdir, CHAR *newdir) /* change to root without a trailing backslash. The function call succeeds but the directory is not changed. */ - strcpy(tmpstr,"C:"); + sprintf(tmpstr, "%c:", newdir[0]); test_setdir(newdir,tmpstr,newdir,1,"check 10"); /* works however with a trailing backslash */ - strcpy(tmpstr,"C:\"); + sprintf(tmpstr, "%c:\", newdir[0]); test_setdir(newdir,tmpstr,NULL,1,"check 11"); }
@@ -901,15 +901,18 @@ static void test_GetTempPath(void) char windir[MAX_PATH]; char buf[MAX_PATH];
- GetEnvironmentVariableA("TMP", save_TMP, sizeof(save_TMP)); + if (!GetEnvironmentVariableA("TMP", save_TMP, sizeof(save_TMP))) save_TMP[0] = 0;
/* test default configuration */ trace("TMP=%s\n", save_TMP); - strcpy(buf,save_TMP); - if (buf[strlen(buf)-1]!='\') - strcat(buf,"\"); - test_GetTempPathA(buf); - test_GetTempPathW(buf); + if (save_TMP[0]) + { + strcpy(buf,save_TMP); + if (buf[strlen(buf)-1]!='\') + strcat(buf,"\"); + test_GetTempPathA(buf); + test_GetTempPathW(buf); + }
/* TMP=C:\WINDOWS */ GetWindowsDirectoryA(windir, sizeof(windir)); @@ -1216,8 +1219,11 @@ static void test_drive_letter_case(void) ret = GetTempPath(sizeof(buf), buf); ok(ret, "GetTempPath error %u\n", GetLastError()); ok(ret < sizeof(buf), "buffer should be %u bytes\n", ret); - ok(buf[1] == ':', "expected buf[1] == ':' got %c\n", buf[1]); - ok(buf[strlen(buf)-1] == '\', "Temporary path (%s) doesn't end in a slash\n", buf); + if (buf[0]) + { + ok(buf[1] == ':', "expected buf[1] == ':' got %c\n", buf[1]); + ok(buf[strlen(buf)-1] == '\', "Temporary path (%s) doesn't end in a slash\n", buf); + }
memset(buf, 0, sizeof(buf)); SetLastError(0xdeadbeef);