2 * Unit test suite for dir functions
4 * Copyright 2006 CodeWeavers, Aric Stewart
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "wine/test.h"
34 void test_fullpath(void)
37 char tmppath
[MAX_PATH
];
38 char level1
[MAX_PATH
];
39 char level2
[MAX_PATH
];
40 char teststring
[MAX_PATH
];
45 GetTempPath(MAX_PATH
,tmppath
);
46 strcpy(level1
,tmppath
);
47 strcat(level1
,"msvcrt-test\\");
49 rc
= CreateDirectory(level1
,NULL
);
50 if (!rc
&& GetLastError()==ERROR_ALREADY_EXISTS
)
53 strcpy(level2
,level1
);
54 strcat(level2
,"nextlevel\\");
55 rc
= CreateDirectory(level2
,NULL
);
56 if (!rc
&& GetLastError()==ERROR_ALREADY_EXISTS
)
58 SetCurrentDirectory(level2
);
60 ok(_fullpath(full
,"test", MAX_PATH
)!=NULL
,"_fullpath failed\n");
61 strcpy(teststring
,level2
);
62 strcat(teststring
,"test");
63 ok(strcmp(full
,teststring
)==0,"Invalid Path returned %s\n",full
);
64 ok(_fullpath(full
,"\\test", MAX_PATH
)!=NULL
,"_fullpath failed\n");
65 strncpy(teststring
,level2
,3);
67 strcat(teststring
,"test");
68 ok(strcmp(full
,teststring
)==0,"Invalid Path returned %s\n",full
);
69 ok(_fullpath(full
,"..\\test", MAX_PATH
)!=NULL
,"_fullpath failed\n");
70 strcpy(teststring
,level1
);
71 strcat(teststring
,"test");
72 ok(strcmp(full
,teststring
)==0,"Invalid Path returned %s\n",full
);
73 ok(_fullpath(full
,"..\\test", 10)==NULL
,"_fullpath failed to generate error\n");
75 freeme
= _fullpath(NULL
,"test", 0);
76 ok(freeme
!=NULL
,"No path returned\n");
77 strcpy(teststring
,level2
);
78 strcat(teststring
,"test");
79 ok(strcmp(freeme
,teststring
)==0,"Invalid Path returned %s\n",freeme
);
83 RemoveDirectory(level2
);
85 RemoveDirectory(level1
);