conformance test for ShellExecute

Dan Kegel dank at kegel.com
Sun Dec 29 18:45:05 CST 2002


Well, the puny little beginnings of one, anyway.
(I'll improve this later.  Still, it already
catches a difference between Windows and Wine,
so it's worth committing as is.)

How do other people develop these tests?
I added a few definitions that let this file
optionally compile standalone, which made things
easier on Windows.

I also noticed that ok() doesn't print out the values
involved, so I added a little eq() test macro in this
file.  Maybe if people like the idea it could move
into wine/test.h.

Changelog:
	* shell32/tests/shlexec.c: added.  Initial conformance test for ShellExecute

Copyright 2002, Dan Kegel.  LGPL.


-- 
Dan Kegel
Linux User #78045
http://www.kegel.com
-------------- next part --------------
Index: dlls/shell32/tests/Makefile.in
===================================================================
RCS file: /home/wine/wine/dlls/shell32/tests/Makefile.in,v
retrieving revision 1.2
diff -d -u -r1.2 Makefile.in
--- dlls/shell32/tests/Makefile.in	12 Nov 2002 01:13:10 -0000	1.2
+++ dlls/shell32/tests/Makefile.in	30 Dec 2002 00:25:11 -0000
@@ -7,6 +7,7 @@
 
 CTESTS = \
 	generated.c \
+	shlexec.c \
 	shlfileop.c
 
 @MAKE_TEST_RULES@
--- /dev/null	2002-08-30 16:31:37.000000000 -0700
+++ dlls/shell32/tests/shlexec.c	2002-12-29 16:17:15.000000000 -0800
@@ -0,0 +1,52 @@
+/*
+ * Unit test of the ShellExecute function.
+ *
+ * Copyright 2002 Dan Kegel
+ *
+ * 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 <stdio.h>
+ 
+#if 1
+
+/* normal -- use when building in wine tree. */
+
+#include "wtypes.h"
+#include "winbase.h"
+#include "windef.h"
+#include "shellapi.h"
+#include "wine/test.h"
+
+#else
+
+/* standalone -- easier to compile under windows */
+#include <wtypes.h>
+#include <winbase.h>
+#include <windef.h>
+#include <shellapi.h>
+#define ok(a, b) assert(a)
+#define START_TEST(a) main(int argc, char **argv)
+
+#endif
+
+/** Assert that a == b.  Print comment c upon failure.  a and b must fit in a long. */
+#define eq(a, b, c) { long va = (long)(a); long vb = (long)(b); if (va != vb) { printf("%ld != %ld\n", va, vb);}  ok(va == vb, c); }
+
+START_TEST(shlexec)
+{
+	/* let's start off easy, and just verify a few error values. */
+	eq(ERROR_FILE_NOT_FOUND, ShellExecute(NULL, "open", "nonexistentfile.exe", NULL, NULL, SW_SHOWNORMAL), "ShellExecute");
+}


More information about the wine-patches mailing list