shell32/tests: Fix a test_argify() check that fails on NT4 and Windows 2000.

This commit is contained in:
Francois Gouget 2012-10-16 16:07:08 +02:00 committed by Alexandre Julliard
parent 82c1fb41aa
commit 47d4041dc1

View File

@ -704,7 +704,7 @@ static int StrCmpPath(const char* s1, const char* s2)
return 0;
}
static void _okChildString(const char* file, int line, const char* key, const char* expected)
static void _okChildString(const char* file, int line, const char* key, const char* expected, const char* bad)
{
char* result;
result=getChildString("Arguments", key);
@ -713,7 +713,8 @@ static void _okChildString(const char* file, int line, const char* key, const ch
ok_(file, line)(FALSE, "%s expected '%s', but key not found or empty\n", key, expected);
return;
}
ok_(file, line)(lstrcmpiA(result, expected) == 0,
ok_(file, line)(lstrcmpiA(result, expected) == 0 ||
broken(lstrcmpiA(result, bad) == 0),
"%s expected '%s', got '%s'\n", key, expected, result);
}
@ -738,7 +739,8 @@ static void _okChildInt(const char* file, int line, const char* key, int expecte
"%s expected %d, but got %d\n", key, expected, result);
}
#define okChildString(key, expected) _okChildString(__FILE__, __LINE__, (key), (expected))
#define okChildString(key, expected) _okChildString(__FILE__, __LINE__, (key), (expected), (expected))
#define okChildStringBroken(key, expected, broken) _okChildString(__FILE__, __LINE__, (key), (expected), (broken))
#define okChildPath(key, expected) _okChildPath(__FILE__, __LINE__, (key), (expected))
#define okChildInt(key, expected) _okChildInt(__FILE__, __LINE__, (key), (expected))
@ -1219,6 +1221,7 @@ typedef struct
const char* params;
int todo;
cmdline_tests_t cmd;
cmdline_tests_t broken;
} argify_tests_t;
static const argify_tests_t argify_tests[] =
@ -1324,7 +1327,9 @@ static const argify_tests_t argify_tests[] =
/* An unclosed quoted string gets lost! */
{"Params23456", "p2 \"p3\" \"p4 is lost", 0x1c3,
{" \"p2\" \"p3\" \"\" \"\" \"\"",
{"", "p2", "p3", "", "", "", NULL}, 0}},
{"", "p2", "p3", "", "", "", NULL}, 0},
{" \"p2\" \"p3\" \"p3\" \"\" \"\"",
{"", "p2", "p3", "p3", "", "", NULL}, 0}},
/* Backslashes have no special meaning even when preceding quotes. All
* they do is start an unquoted string.
@ -1376,6 +1381,7 @@ static void test_argify(void)
char fileA[MAX_PATH], params[2*MAX_PATH+12];
INT_PTR rc;
const argify_tests_t* test;
const cmdline_tests_t *bad;
const char* cmd;
unsigned i, count;
@ -1392,6 +1398,8 @@ static void test_argify(void)
test = argify_tests;
while (test->params)
{
bad = test->broken.cmd ? &test->broken : &test->cmd;
/* trace("***** verb='%s' params='%s'\n", test->verb, test->params); */
rc = shell_execute_ex(SEE_MASK_DOENVSUBST, test->verb, fileA, test->params, NULL, NULL);
ok(rc > 32, "%s failed: rc=%lu\n", shell_call, rc);
@ -1415,18 +1423,20 @@ static void test_argify(void)
if (cmd) cmd += strlen(test->verb);
if (!cmd) cmd = "(null)";
if ((test->todo & 0x2) == 0)
ok(!strcmp(cmd, test->cmd.cmd), "%s: the cmdline is '%s' instead of '%s'\n", shell_call, cmd, test->cmd.cmd);
ok(!strcmp(cmd, test->cmd.cmd) || broken(!strcmp(cmd, bad->cmd)),
"%s: the cmdline is '%s' instead of '%s'\n", shell_call, cmd, test->cmd.cmd);
else todo_wine
ok(!strcmp(cmd, test->cmd.cmd), "%s: the cmdline is '%s' instead of '%s'\n", shell_call, cmd, test->cmd.cmd);
ok(!strcmp(cmd, test->cmd.cmd) || broken(!strcmp(cmd, bad->cmd)),
"%s: the cmdline is '%s' instead of '%s'\n", shell_call, cmd, test->cmd.cmd);
for (i = 0; i < count - 1; i++)
{
char argname[18];
sprintf(argname, "argvA%d", 4 + i);
if ((test->todo & (1 << (i+4))) == 0)
okChildString(argname, test->cmd.args[i+1]);
okChildStringBroken(argname, test->cmd.args[i+1], bad->args[i+1]);
else todo_wine
okChildString(argname, test->cmd.args[i+1]);
okChildStringBroken(argname, test->cmd.args[i+1], bad->args[i+1]);
}
if (has_cl2a)