Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Add test for last glob bug.
- Loading branch information
Ulrich Drepper
committed
Mar 24, 2010
1 parent
8f2e399
commit c27849f
Showing
3 changed files
with
55 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#include <glob.h> | ||
#include <stdio.h> | ||
#include <string.h> | ||
|
||
static int | ||
do_test (void) | ||
{ | ||
int result = 0; | ||
glob_t g; | ||
g.gl_pathc = 0; | ||
|
||
int r = glob ("", 0, NULL, &g); | ||
if (r != GLOB_NOMATCH) | ||
{ | ||
puts ("glob (\"\", 0, NULL, &g) did not fail"); | ||
result = 1; | ||
} | ||
else if (g.gl_pathc != 0) | ||
{ | ||
puts ("gl_pathc after glob (\"\", 0, NULL, &g) not zero"); | ||
result = 1; | ||
} | ||
|
||
r = glob ("", GLOB_NOCHECK, NULL, &g); | ||
if (r != 0) | ||
{ | ||
puts ("glob (\"\", GLOB_NOCHECK, NULL, &g) did fail"); | ||
result = 1; | ||
} | ||
else if (g.gl_pathc != 1) | ||
{ | ||
puts ("gl_pathc after glob (\"\", GLOB_NOCHECK, NULL, &g) not 1"); | ||
result = 1; | ||
} | ||
else if (strcmp (g.gl_pathv[0], "") != 0) | ||
{ | ||
puts ("gl_pathv[0] after glob (\"\", GLOB_NOCHECK, NULL, &g) not \"\""); | ||
result = 1; | ||
} | ||
|
||
return result; | ||
} | ||
|
||
#define TEST_FUNCTION do_test () | ||
#include "../test-skeleton.c" |