]> Savannah Git Hosting - gnulib.git/commitdiff
glob-h: Add tests.
authorBruno Haible <bruno@clisp.org>
Tue, 7 Aug 2018 08:54:41 +0000 (10:54 +0200)
committerBruno Haible <bruno@clisp.org>
Tue, 7 Aug 2018 08:54:41 +0000 (10:54 +0200)
* 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.

ChangeLog
modules/glob-c++-tests [deleted file]
modules/glob-h-c++-tests [new file with mode: 0644]
modules/glob-h-tests [new file with mode: 0644]
modules/glob-tests
tests/test-glob-c++.cc [deleted file]
tests/test-glob-h-c++.cc [new file with mode: 0644]
tests/test-glob-h.c [new file with mode: 0644]
tests/test-glob.c

index 2873cd0fa8a50225f8ee5b8ff4b4c73c125330e1..a1c0abbaba01b891e9b672c87f28476950553e29 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2018-08-07  Bruno Haible  <bruno@clisp.org>
+
+       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.
+
 2018-08-07  Bruno Haible  <bruno@clisp.org>
 
        glob-h: New module.
diff --git a/modules/glob-c++-tests b/modules/glob-c++-tests
deleted file mode 100644 (file)
index daa3ec7..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-Files:
-tests/test-glob-c++.cc
-tests/signature.h
-
-Status:
-c++-test
-
-Depends-on:
-ansi-c++-opt
-
-configure.ac:
-
-Makefile.am:
-if ANSICXX
-TESTS += test-glob-c++
-check_PROGRAMS += test-glob-c++
-test_glob_c___SOURCES = test-glob-c++.cc
-test_glob_c___LDADD = $(LDADD) $(LIBINTL) $(LIB_CLOCK_GETTIME)
-endif
diff --git a/modules/glob-h-c++-tests b/modules/glob-h-c++-tests
new file mode 100644 (file)
index 0000000..de42019
--- /dev/null
@@ -0,0 +1,19 @@
+Files:
+tests/test-glob-h-c++.cc
+tests/signature.h
+
+Status:
+c++-test
+
+Depends-on:
+ansi-c++-opt
+
+configure.ac:
+
+Makefile.am:
+if ANSICXX
+TESTS += test-glob-h-c++
+check_PROGRAMS += test-glob-h-c++
+test_glob_h_c___SOURCES = test-glob-h-c++.cc
+test_glob_h_c___LDADD = $(LDADD) $(LIBINTL) $(LIB_CLOCK_GETTIME)
+endif
diff --git a/modules/glob-h-tests b/modules/glob-h-tests
new file mode 100644 (file)
index 0000000..0e9e5bd
--- /dev/null
@@ -0,0 +1,12 @@
+Files:
+tests/test-glob-h.c
+tests/macros.h
+
+Depends-on:
+glob-h-c++-tests
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-glob-h
+check_PROGRAMS += test-glob-h
index abc3666eddbcb4ab379752f22718dddf7a056a86..3adbe6c80e9a44501d1c5ff4edb712b8134a9843 100644 (file)
@@ -4,7 +4,6 @@ tests/signature.h
 tests/macros.h
 
 Depends-on:
-glob-c++-tests
 symlink
 
 configure.ac:
diff --git a/tests/test-glob-c++.cc b/tests/test-glob-c++.cc
deleted file mode 100644 (file)
index ec0150a..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Test of glob/globfree functions in C++ mode.
-   Copyright (C) 2010-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 Bruno Haible <bruno@clisp.org>, 2010.  */
-
-#define GNULIB_NAMESPACE gnulib
-#include <config.h>
-
-#include <glob.h>
-
-#include "signature.h"
-
-
-SIGNATURE_CHECK (GNULIB_NAMESPACE::glob, int,
-                 (const char *, int, _gl_glob_errfunc_fn, glob_t *));
-
-SIGNATURE_CHECK (GNULIB_NAMESPACE::globfree, void, (glob_t *));
-
-//SIGNATURE_CHECK (GNULIB_NAMESPACE::glob_pattern_p, int, (const char *, int));
-
-
-int
-main ()
-{
-}
diff --git a/tests/test-glob-h-c++.cc b/tests/test-glob-h-c++.cc
new file mode 100644 (file)
index 0000000..ff644bd
--- /dev/null
@@ -0,0 +1,44 @@
+/* Test of glob/globfree functions in C++ mode.
+   Copyright (C) 2010-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 Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#define GNULIB_NAMESPACE gnulib
+#include <config.h>
+
+#include <glob.h>
+
+#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
+
+#if GNULIB_TEST_GLOB
+SIGNATURE_CHECK (GNULIB_NAMESPACE::glob_pattern_p, int, (const char *, int));
+#endif
+
+
+int
+main ()
+{
+}
diff --git a/tests/test-glob-h.c b/tests/test-glob-h.c
new file mode 100644 (file)
index 0000000..88caecb
--- /dev/null
@@ -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;
+}
index 50b20ea6a64f010003f51f900b500ff39dced413..cd21b5c371d4702c26110ec4343793718d62f7ba 100644 (file)
 
 #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);