]> Savannah Git Hosting - gnulib.git/commitdiff
sys_un: Add C++ tests.
authorCollin Funk <collin.funk1@gmail.com>
Thu, 25 Jul 2024 03:27:46 +0000 (20:27 -0700)
committerCollin Funk <collin.funk1@gmail.com>
Thu, 25 Jul 2024 03:27:46 +0000 (20:27 -0700)
* modules/sys_un-c++-tests: New file.
* tests/test-sys_un-c++.cc: New file.
* modules/sys_un-tests (Depends-on): Add sys_un-c++-tests.

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

index 8c93d18bdc554ded56efd6f20d8c25363e71eaa0..ad0e632c0307931a8f145e90a9d5e03a68ab2417 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2024-07-24  Collin Funk  <collin.funk1@gmail.com>
 
+       sys_un: Add C++ tests.
+       * modules/sys_un-c++-tests: New file.
+       * tests/test-sys_un-c++.cc: New file.
+       * modules/sys_un-tests (Depends-on): Add sys_un-c++-tests.
+
        sys_un: Add tests.
        * modules/sys_un-tests: New file.
        * tests/test-sys_un.c: New file.
diff --git a/modules/sys_un-c++-tests b/modules/sys_un-c++-tests
new file mode 100644 (file)
index 0000000..d5aac51
--- /dev/null
@@ -0,0 +1,17 @@
+Files:
+tests/test-sys_un-c++.cc
+
+Status:
+c++-test
+
+Depends-on:
+ansi-c++-opt
+
+configure.ac:
+
+Makefile.am:
+if ANSICXX
+TESTS += test-sys_un-c++
+check_PROGRAMS += test-sys_un-c++
+test_sys_un_c___SOURCES = test-sys_un-c++.cc
+endif
index a7d912be0c89bc8d8ad764cc4f96d4db45261481..ef4e81bb82f0cd701c77fea0859de927c8412aea 100644 (file)
@@ -3,6 +3,7 @@ tests/test-sys_un.c
 
 Depends-on:
 assert-h
+sys_un-c++-tests
 
 configure.ac:
 
diff --git a/tests/test-sys_un-c++.cc b/tests/test-sys_un-c++.cc
new file mode 100644 (file)
index 0000000..5b2e391
--- /dev/null
@@ -0,0 +1,44 @@
+/* Test of the <sys/un.h> substitute in C++ mode.
+   Copyright (C) 2024 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 Collin Funk <collin.funk1@gmail.com>, 2024.  */
+
+#define GNULIB_NAMESPACE gnulib
+#include <config.h>
+
+#if HAVE_UNIXSOCKET
+
+# include <sys/un.h>
+
+int
+main ()
+{
+}
+
+#else
+
+/* UNIX domain sockets unsupported.  */
+
+# include <iostream>
+
+int
+main ()
+{
+  std::cout << "Skipping test: UNIX domain sockets not supported" << std::endl;
+  return 77;
+}
+
+#endif