Ilya Basin : shell32/tests: SHELL_ArgifyW(%2|%*|%~3, ...) tests.
Alexandre Julliard
julliard at winehq.org
Fri Jun 25 09:40:56 CDT 2010
Module: wine
Branch: master
Commit: 9c23b5debcd4a55492c1e8c4f2e117b43c37db37
URL: http://source.winehq.org/git/wine.git/?a=commit;h=9c23b5debcd4a55492c1e8c4f2e117b43c37db37
Author: Ilya Basin <basinilya at gmail.com>
Date: Tue Jun 22 23:15:04 2010 +0400
shell32/tests: SHELL_ArgifyW(%2|%*|%~3, ...) tests.
---
dlls/shell32/tests/shlexec.c | 137 ++++++++++++++++++++++++++++++++++++++++++
1 files changed, 137 insertions(+), 0 deletions(-)
diff --git a/dlls/shell32/tests/shlexec.c b/dlls/shell32/tests/shlexec.c
index 8455776..b883d0b 100644
--- a/dlls/shell32/tests/shlexec.c
+++ b/dlls/shell32/tests/shlexec.c
@@ -960,6 +960,133 @@ static void test_lpFile_parsed(void)
"expected success (33), got %s (%d), lpFile: %s\n",
rc > 32 ? "success" : "failure", rc, fileA
);
+
+}
+
+static void test_argify(void)
+{
+ char fileA[MAX_PATH];
+
+ int rc;
+
+ sprintf(fileA, "%s\\test file.shlexec", tmpdir);
+
+ /* %2 */
+ rc=shell_execute("NoQuotesParam2", fileA, "a b", NULL);
+ ok(rc>32,
+ "expected success (33), got %s (%d), lpFile: %s\n",
+ rc > 32 ? "success" : "failure", rc, fileA
+ );
+ if (rc>32)
+ {
+ okChildInt("argcA", 5);
+ okChildString("argvA4", "a");
+ }
+
+ /* %2 */
+ /* '"a"""' -> 'a"' */
+ rc=shell_execute("NoQuotesParam2", fileA, "\"a:\"\"some string\"\"\"", NULL);
+ ok(rc>32,
+ "expected success (33), got %s (%d), lpFile: %s\n",
+ rc > 32 ? "success" : "failure", rc, fileA
+ );
+ if (rc>32)
+ {
+ okChildInt("argcA", 5);
+ todo_wine {
+ okChildString("argvA4", "a:some string");
+ }
+ }
+
+ /* %2 */
+ /* backslash isn't escape char
+ * '"a\""' -> '"a\""' */
+ rc=shell_execute("NoQuotesParam2", fileA, "\"a:\\\"some string\\\"\"", NULL);
+ ok(rc>32,
+ "expected success (33), got %s (%d), lpFile: %s\n",
+ rc > 32 ? "success" : "failure", rc, fileA
+ );
+ if (rc>32)
+ {
+ okChildInt("argcA", 5);
+ todo_wine {
+ okChildString("argvA4", "a:\\");
+ }
+ }
+
+ /* "%2" */
+ /* \t isn't whitespace */
+ rc=shell_execute("QuotedParam2", fileA, "a\tb c", NULL);
+ ok(rc>32,
+ "expected success (33), got %s (%d), lpFile: %s\n",
+ rc > 32 ? "success" : "failure", rc, fileA
+ );
+ if (rc>32)
+ {
+ okChildInt("argcA", 5);
+ todo_wine {
+ okChildString("argvA4", "a\tb");
+ }
+ }
+
+ /* %* */
+ rc=shell_execute("NoQuotesAllParams", fileA, "a b c d e f g h", NULL);
+ ok(rc>32,
+ "expected success (33), got %s (%d), lpFile: %s\n",
+ rc > 32 ? "success" : "failure", rc, fileA
+ );
+ if (rc>32)
+ {
+ todo_wine {
+ okChildInt("argcA", 12);
+ okChildString("argvA4", "a");
+ okChildString("argvA11", "h");
+ }
+ }
+
+ /* %* can sometimes contain only whitespaces and no args */
+ rc=shell_execute("QuotedAllParams", fileA, " ", NULL);
+ ok(rc>32,
+ "expected success (33), got %s (%d), lpFile: %s\n",
+ rc > 32 ? "success" : "failure", rc, fileA
+ );
+ if (rc>32)
+ {
+ todo_wine {
+ okChildInt("argcA", 5);
+ okChildString("argvA4", " ");
+ }
+ }
+
+ /* %~3 */
+ rc=shell_execute("NoQuotesParams345etc", fileA, "a b c d e f g h", NULL);
+ ok(rc>32,
+ "expected success (33), got %s (%d), lpFile: %s\n",
+ rc > 32 ? "success" : "failure", rc, fileA
+ );
+ if (rc>32)
+ {
+ todo_wine {
+ okChildInt("argcA", 11);
+ okChildString("argvA4", "b");
+ okChildString("argvA10", "h");
+ }
+ }
+
+ /* %~3 is rest of command line starting with whitespaces after 2nd arg */
+ rc=shell_execute("QuotedParams345etc", fileA, "a ", NULL);
+ ok(rc>32,
+ "expected success (33), got %s (%d), lpFile: %s\n",
+ rc > 32 ? "success" : "failure", rc, fileA
+ );
+ if (rc>32)
+ {
+ okChildInt("argcA", 5);
+ todo_wine {
+ okChildString("argvA4", " ");
+ }
+ }
+
}
static void test_filename(void)
@@ -1935,6 +2062,15 @@ static void init_test(void)
create_test_verb(".shlexec", "QuotedLowerL", 0, "QuotedLowerL \"%l\"");
create_test_verb(".shlexec", "UpperL", 0, "UpperL %L");
create_test_verb(".shlexec", "QuotedUpperL", 0, "QuotedUpperL \"%L\"");
+
+ create_test_verb(".shlexec", "NoQuotesParam2", 0, "NoQuotesParam2 %2");
+ create_test_verb(".shlexec", "QuotedParam2", 0, "QuotedParam2 \"%2\"");
+
+ create_test_verb(".shlexec", "NoQuotesAllParams", 0, "NoQuotesAllParams %*");
+ create_test_verb(".shlexec", "QuotedAllParams", 0, "QuotedAllParams \"%*\"");
+
+ create_test_verb(".shlexec", "NoQuotesParams345etc", 0, "NoQuotesParams345etc %~3");
+ create_test_verb(".shlexec", "QuotedParams345etc", 0, "QuotedParams345etc \"%~3\"");
}
static void cleanup_test(void)
@@ -2048,6 +2184,7 @@ START_TEST(shlexec)
init_test();
+ test_argify();
test_lpFile_parsed();
test_filename();
test_find_executable();
More information about the wine-cvs
mailing list