diff options
author | Bruno Haible <bruno@clisp.org> | 2018-08-07 10:54:41 +0200 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2018-08-07 10:54:41 +0200 |
commit | 3bd9c3d70ab02c439c0a6880127d5c28c3017e6e (patch) | |
tree | 1b978c0f05d34ac3a6aabb98cd5b2bce661b019b /tests | |
parent | 490c345b1425350e8749a00ec9566d29521d92db (diff) | |
download | gnulib-3bd9c3d70ab02c439c0a6880127d5c28c3017e6e.tar.gz |
glob-h: Add tests.
* tests/test-glob-h.c: New file, partially based on tests/test-glob.c.
* tests/test-glob.c: Reorder #includes. Remove tests that are moved to
tests/test-glob-h.c.
* modules/glob-h-tests: New file.
* tests/test-glob-h-c++.cc: Renamed from tests/test-glob-c++.cc. Add
conditions.
* modules/glob-h-c++-tests: Renamed from modules/glob-c++-tests.
* modules/glob-tests (Depends-on): Remove glob-c++-tests.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test-glob-h-c++.cc (renamed from tests/test-glob-c++.cc) | 8 | ||||
-rw-r--r-- | tests/test-glob-h.c | 57 | ||||
-rw-r--r-- | tests/test-glob.c | 10 |
3 files changed, 66 insertions, 9 deletions
diff --git a/tests/test-glob-c++.cc b/tests/test-glob-h-c++.cc index ec0150a3e7..ff644bd8cf 100644 --- a/tests/test-glob-c++.cc +++ b/tests/test-glob-h-c++.cc @@ -24,12 +24,18 @@ #include "signature.h" +#if GNULIB_TEST_GLOB SIGNATURE_CHECK (GNULIB_NAMESPACE::glob, int, (const char *, int, _gl_glob_errfunc_fn, glob_t *)); +#endif +#if GNULIB_TEST_GLOB SIGNATURE_CHECK (GNULIB_NAMESPACE::globfree, void, (glob_t *)); +#endif -//SIGNATURE_CHECK (GNULIB_NAMESPACE::glob_pattern_p, int, (const char *, int)); +#if GNULIB_TEST_GLOB +SIGNATURE_CHECK (GNULIB_NAMESPACE::glob_pattern_p, int, (const char *, int)); +#endif int diff --git a/tests/test-glob-h.c b/tests/test-glob-h.c new file mode 100644 index 0000000000..88caecb4fd --- /dev/null +++ b/tests/test-glob-h.c @@ -0,0 +1,57 @@ +/* Test of <glob.h> substitute. + Copyright (C) 2009-2018 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. */ + +/* Written by Simon Josefsson <simon@josefsson.org>, 2009. */ + +#include <config.h> + +#include <glob.h> + +#include "macros.h" + +/* Check that size_t is defined. */ +size_t a; + +/* Check that the various GLOB_* macros are defined. */ +int flags[] = + { + GLOB_APPEND, + GLOB_DOOFFS, + GLOB_ERR, + GLOB_MARK, + GLOB_NOCHECK, + GLOB_NOESCAPE, + GLOB_NOSORT + }; +int ret[] = + { + GLOB_ABORTED, + GLOB_NOMATCH, + GLOB_NOSPACE + }; + +int +main () +{ + glob_t g; + + /* Make sure glob_t struct members exists. */ + ASSERT (sizeof (g.gl_pathc)); + ASSERT (sizeof (g.gl_pathv)); + ASSERT (sizeof (g.gl_offs)); + + return 0; +} diff --git a/tests/test-glob.c b/tests/test-glob.c index 50b20ea6a6..cd21b5c371 100644 --- a/tests/test-glob.c +++ b/tests/test-glob.c @@ -20,15 +20,14 @@ #include <glob.h> -#include <errno.h> -#include <unistd.h> - #include "signature.h" SIGNATURE_CHECK (glob, int, (char const *, int, int (*) (char const *, int), glob_t *)); SIGNATURE_CHECK (globfree, void, (glob_t *)); +#include <errno.h> #include <string.h> +#include <unistd.h> #include "macros.h" @@ -41,11 +40,6 @@ main () int res; glob_t g; - /* Make sure glob_t struct members exists. */ - ASSERT (sizeof (g.gl_pathc)); - ASSERT (sizeof (g.gl_pathv)); - ASSERT (sizeof (g.gl_offs)); - res = glob (".", 0, NULL, &g); ASSERT (res == 0 && g.gl_pathc == 1); globfree (&g); |