summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2023-03-24 11:57:19 +0100
committerBruno Haible <bruno@clisp.org>2023-03-24 11:57:19 +0100
commit6a8aeae6854226579bbd42a496e8a07f4d8bb8ec (patch)
treeb2f5bccf0172a46b353d864866a0c6ff8a6e796b /tests
parent171d2a5f80f3d0dc720a291c349486944fd35243 (diff)
downloadgnulib-6a8aeae6854226579bbd42a496e8a07f4d8bb8ec.tar.gz
printf-gnu: Add tests.
* tests/test-printf-gnu.sh: New file, based on tests/test-printf-posix.sh. * tests/test-printf-gnu.c: New file, based on tests/test-printf-posix.c. * modules/printf-gnu-tests: New file, based on modules/printf-posix-tests.
Diffstat (limited to 'tests')
-rw-r--r--tests/test-printf-gnu.c35
-rwxr-xr-xtests/test-printf-gnu.sh16
2 files changed, 51 insertions, 0 deletions
diff --git a/tests/test-printf-gnu.c b/tests/test-printf-gnu.c
new file mode 100644
index 0000000000..ed7bf6bd95
--- /dev/null
+++ b/tests/test-printf-gnu.c
@@ -0,0 +1,35 @@
+/* Test of POSIX and GNU compatible printf() function.
+ Copyright (C) 2007-2023 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>, 2007. */
+
+#include <config.h>
+
+#include <stdio.h>
+
+#include <stddef.h>
+#include <string.h>
+
+#include "macros.h"
+
+#include "test-printf-gnu.h"
+
+int
+main (int argc, char *argv[])
+{
+ test_function (printf);
+ return 0;
+}
diff --git a/tests/test-printf-gnu.sh b/tests/test-printf-gnu.sh
new file mode 100755
index 0000000000..179ade635f
--- /dev/null
+++ b/tests/test-printf-gnu.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+tmpfiles=""
+trap 'rm -fr $tmpfiles' HUP INT QUIT TERM
+
+tmpfiles="$tmpfiles t-printf-gnu.tmp t-printf-gnu.out"
+${CHECKER} ./test-printf-gnu${EXEEXT} > t-printf-gnu.tmp || exit 1
+LC_ALL=C tr -d '\r' < t-printf-gnu.tmp > t-printf-gnu.out || exit 1
+
+: "${DIFF=diff}"
+${DIFF} "${srcdir}/test-printf-gnu.output" t-printf-gnu.out
+result=$?
+
+rm -fr $tmpfiles
+
+exit $result