Skip to content

Commit 4fafe46

Browse files
authored
Add tristate option to fix cmd:attrib test (reactos#8344)
- Add a tristate option to accept either true or false for the bStdOutput and bStdError tests - Use this new option on the four tests that are inconsistent.
1 parent c687f6e commit 4fafe46

File tree

1 file changed

+8
-6
lines changed
  • modules/rostests/apitests/cmd

1 file changed

+8
-6
lines changed

modules/rostests/apitests/cmd/cmd.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ typedef struct TEST_ENTRY
2222
const char *ErrorNotContains;
2323
} TEST_ENTRY;
2424

25+
#define TRISTATE 2
26+
2527
static const TEST_ENTRY s_exit_entries[] =
2628
{
2729
{ __LINE__, 0, "cmd /c exit" },
@@ -162,9 +164,9 @@ static const TEST_ENTRY s_attrib_entries[] =
162164
{ __LINE__, 0, "attrib /S attr-te*.txt", TRUE, FALSE, " H " },
163165
{ __LINE__, 0, "attrib /S -H attr-te*.txt", FALSE, FALSE },
164166
{ __LINE__, 0, "attrib /S attr-te*.txt", TRUE, FALSE, NULL, NULL, " H " },
165-
{ __LINE__, 0, "attrib /S +H", FALSE, FALSE },
167+
{ __LINE__, 0, "attrib /S +H", TRISTATE, FALSE },
166168
{ __LINE__, 0, "attrib /S attr-test.txt", TRUE, FALSE, " H " },
167-
{ __LINE__, 0, "attrib /S -H", FALSE, FALSE },
169+
{ __LINE__, 0, "attrib /S -H", TRISTATE, FALSE },
168170
{ __LINE__, 0, "attrib /S attr-test.txt", TRUE, FALSE, NULL, NULL, " H " },
169171
{ __LINE__, 0, "cmd /c if exist attr-test.txt attrib -H attr-test.txt" },
170172
{ __LINE__, 0, "cmd /c if exist attr-test.txt del /Q attr-test.txt" },
@@ -307,10 +309,10 @@ static const TEST_ENTRY s_attrib_entries[] =
307309
{ __LINE__, 0, "attrib /S attr-test.txt", TRUE, FALSE, " H " },
308310
{ __LINE__, 0, "attrib /S -H attr-test.txt", FALSE, FALSE },
309311
{ __LINE__, 0, "attrib /S attr-test.txt", TRUE, FALSE, NULL, NULL, " H " },
310-
{ __LINE__, 0, "attrib /S +H", FALSE, FALSE },
312+
{ __LINE__, 0, "attrib /S +H", TRISTATE, FALSE },
311313
{ __LINE__, 0, "attrib /S attr-test.txt", TRUE, FALSE, " H " },
312314
{ __LINE__, 0, "attrib /S attr-tes*.*", TRUE, FALSE, " H " },
313-
{ __LINE__, 0, "attrib /S -H", FALSE, FALSE },
315+
{ __LINE__, 0, "attrib /S -H", TRISTATE, FALSE },
314316
{ __LINE__, 0, "attrib /S attr-test.txt", TRUE, FALSE, NULL, NULL, " H " },
315317
{ __LINE__, 0, "attrib /S attr-tes*.*", TRUE, FALSE, NULL, NULL, " H " },
316318
{ __LINE__, 0, "cmd /c if exist attr-dir/dir1/test.txt attrib -H attr-dir/dir1/test.txt" },
@@ -455,11 +457,11 @@ static void DoTestEntry(const TEST_ENTRY *pEntry)
455457
if (si.hStdError)
456458
CloseHandle(si.hStdError);
457459

458-
ok(pEntry->bStdOutput == bStdOutput,
460+
ok(pEntry->bStdOutput == bStdOutput || pEntry->bStdOutput == TRISTATE,
459461
"Line %u: bStdOutput %d vs %d\n",
460462
pEntry->line, pEntry->bStdOutput, bStdOutput);
461463

462-
ok(pEntry->bStdError == bStdError,
464+
ok(pEntry->bStdError == bStdError || pEntry->bStdOutput == TRISTATE,
463465
"Line %u: bStdError %d vs %d\n",
464466
pEntry->line, pEntry->bStdError, bStdError);
465467

0 commit comments

Comments
 (0)