Module: wine
Branch: refs/heads/master
Commit: 3022ade359fbf35efbeacf120fc0e53eafee84bd
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=3022ade359fbf35efbeacf1…
Author: Aric Stewart <aric(a)codeweavers.com>
Date: Fri Jan 6 21:46:09 2006 +0100
msvcrt: Add a regression test for _fullpath.
---
dlls/msvcrt/tests/.gitignore | 1 +
dlls/msvcrt/tests/Makefile.in | 1 +
dlls/msvcrt/tests/dir.c | 58 +++++++++++++++++++++++++++++++++++++++++
3 files changed, 60 insertions(+), 0 deletions(-)
create mode 100644 dlls/msvcrt/tests/dir.c
diff --git a/dlls/msvcrt/tests/.gitignore b/dlls/msvcrt/tests/.gitignore
index 0aa07c9..2980711 100644
--- a/dlls/msvcrt/tests/.gitignore
+++ b/dlls/msvcrt/tests/.gitignore
@@ -1,5 +1,6 @@
Makefile
cpp.ok
+dir.ok
environ.ok
file.ok
headers.ok
diff --git a/dlls/msvcrt/tests/Makefile.in b/dlls/msvcrt/tests/Makefile.in
index 2681d61..9569f1e 100644
--- a/dlls/msvcrt/tests/Makefile.in
+++ b/dlls/msvcrt/tests/Makefile.in
@@ -9,6 +9,7 @@ EXTRAINCL = -I$(TOPSRCDIR)/include/msvcr
CTESTS = \
cpp.c \
+ dir.c \
environ.c \
file.c \
headers.c \
diff --git a/dlls/msvcrt/tests/dir.c b/dlls/msvcrt/tests/dir.c
new file mode 100644
index 0000000..5e12f84
--- /dev/null
+++ b/dlls/msvcrt/tests/dir.c
@@ -0,0 +1,58 @@
+/*
+ * Unit test suite for dir functions
+ *
+ * Copyright 2006 CodeWeavers, Aric Stewart
+ *
+ * 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 <stdarg.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <io.h>
+#include <windef.h>
+#include <winbase.h>
+#include <winnls.h>
+#include <process.h>
+#include <errno.h>
+
+void test_fullpath()
+{
+ char full[MAX_PATH];
+ char *freeme;
+
+ SetCurrentDirectory("C:\\Windows\\System\\");
+
+ ok(_fullpath(full,"test", MAX_PATH)>0,"_fullpath failed\n");
+ ok(strcmp(full,"C:\\Windows\\System\\test")==0,"Invalid Path\n");
+ ok(_fullpath(full,"\\test", MAX_PATH)>0,"_fullpath failed\n");
+ ok(strcmp(full,"C:\\test")==0,"Invalid Path\n");
+ ok(_fullpath(full,"..\\test", MAX_PATH)>0,"_fullpath failed\n");
+ ok(strcmp(full,"C:\\Windows\\test")==0,"Invalid Path\n");
+ ok(_fullpath(full,"..\\test", 10)==NULL,"_fullpath failed to generate error\n");
+
+ freeme = _fullpath(NULL,"test", 0);
+ ok(freeme!=NULL,"No path returned\n");
+ ok(strcmp(freeme,"C:\\Windows\\System\\test")==0,"Invalid Path\n");
+ free(freeme);
+}
+
+START_TEST(dir)
+{
+ test_fullpath();
+}