msvcrt: Modify dir test to create its own directory to ensure the
directory exists for the test. Using the temp dir as the root.
This commit is contained in:
parent
2eb59ee2b0
commit
4bc3b16b44
|
@ -34,22 +34,55 @@
|
||||||
void test_fullpath()
|
void test_fullpath()
|
||||||
{
|
{
|
||||||
char full[MAX_PATH];
|
char full[MAX_PATH];
|
||||||
|
char tmppath[MAX_PATH];
|
||||||
|
char level1[MAX_PATH];
|
||||||
|
char level2[MAX_PATH];
|
||||||
|
char teststring[MAX_PATH];
|
||||||
char *freeme;
|
char *freeme;
|
||||||
|
BOOL rc,free1,free2;
|
||||||
|
|
||||||
SetCurrentDirectory("C:\\Windows\\System\\");
|
free1=free2=TRUE;
|
||||||
|
GetTempPath(MAX_PATH,tmppath);
|
||||||
|
strcpy(level1,tmppath);
|
||||||
|
strcat(level1,"msvcrt-test\\");
|
||||||
|
|
||||||
ok(_fullpath(full,"test", MAX_PATH)>0,"_fullpath failed\n");
|
rc = CreateDirectory(level1,NULL);
|
||||||
ok(strcmp(full,"C:\\Windows\\System\\test")==0,"Invalid Path\n");
|
if (!rc && GetLastError()==ERROR_ALREADY_EXISTS)
|
||||||
ok(_fullpath(full,"\\test", MAX_PATH)>0,"_fullpath failed\n");
|
free1=FALSE;
|
||||||
ok(strcmp(full,"C:\\test")==0,"Invalid Path\n");
|
|
||||||
ok(_fullpath(full,"..\\test", MAX_PATH)>0,"_fullpath failed\n");
|
strcpy(level2,level1);
|
||||||
ok(strcmp(full,"C:\\Windows\\test")==0,"Invalid Path\n");
|
strcat(level2,"nextlevel\\");
|
||||||
|
rc = CreateDirectory(level2,NULL);
|
||||||
|
if (!rc && GetLastError()==ERROR_ALREADY_EXISTS)
|
||||||
|
free2=FALSE;
|
||||||
|
SetCurrentDirectory(level2);
|
||||||
|
|
||||||
|
ok(_fullpath(full,"test", MAX_PATH)!=NULL,"_fullpath failed\n");
|
||||||
|
strcpy(teststring,level2);
|
||||||
|
strcat(teststring,"test");
|
||||||
|
ok(strcmp(full,teststring)==0,"Invalid Path returned %s\n",full);
|
||||||
|
ok(_fullpath(full,"\\test", MAX_PATH)!=NULL,"_fullpath failed\n");
|
||||||
|
strncpy(teststring,level2,3);
|
||||||
|
teststring[3]=0;
|
||||||
|
strcat(teststring,"test");
|
||||||
|
ok(strcmp(full,teststring)==0,"Invalid Path returned %s\n",full);
|
||||||
|
ok(_fullpath(full,"..\\test", MAX_PATH)!=NULL,"_fullpath failed\n");
|
||||||
|
strcpy(teststring,level1);
|
||||||
|
strcat(teststring,"test");
|
||||||
|
ok(strcmp(full,teststring)==0,"Invalid Path returned %s\n",full);
|
||||||
ok(_fullpath(full,"..\\test", 10)==NULL,"_fullpath failed to generate error\n");
|
ok(_fullpath(full,"..\\test", 10)==NULL,"_fullpath failed to generate error\n");
|
||||||
|
|
||||||
freeme = _fullpath(NULL,"test", 0);
|
freeme = _fullpath(NULL,"test", 0);
|
||||||
ok(freeme!=NULL,"No path returned\n");
|
ok(freeme!=NULL,"No path returned\n");
|
||||||
ok(strcmp(freeme,"C:\\Windows\\System\\test")==0,"Invalid Path\n");
|
strcpy(teststring,level2);
|
||||||
|
strcat(teststring,"test");
|
||||||
|
ok(strcmp(freeme,teststring)==0,"Invalid Path returned %s\n",freeme);
|
||||||
free(freeme);
|
free(freeme);
|
||||||
|
|
||||||
|
if (free2)
|
||||||
|
RemoveDirectory(level2);
|
||||||
|
if (free1)
|
||||||
|
RemoveDirectory(level1);
|
||||||
}
|
}
|
||||||
|
|
||||||
START_TEST(dir)
|
START_TEST(dir)
|
||||||
|
|
Loading…
Reference in New Issue