From: Bruno Haible Date: Sun, 7 Oct 2007 02:47:49 +0000 (+0200) Subject: Test for module 'fopen'. X-Git-Tag: v0.0~122 X-Git-Url: http://erislabs.org.uk/gitweb/?a=commitdiff_plain;h=5b86035a434bd8520e93832b8da5e7427de3318c;p=gnulib.git Test for module 'fopen'. --- diff --git a/ChangeLog b/ChangeLog index ae51c7334..f895211c7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2007-10-06 Bruno Haible + * modules/fopen-tests: New file. + * tests/test-fopen.c: New file. + * modules/fopen: New file. * lib/fopen.c: New file. * m4/fopen.m4: New file. diff --git a/modules/fopen-tests b/modules/fopen-tests new file mode 100644 index 000000000..cf87389a9 --- /dev/null +++ b/modules/fopen-tests @@ -0,0 +1,11 @@ +Files: +tests/test-fopen.c + +Depends-on: + +configure.ac: + +Makefile.am: +TESTS += test-fopen +check_PROGRAMS += test-fopen + diff --git a/tests/test-fopen.c b/tests/test-fopen.c new file mode 100644 index 000000000..76d2ac37e --- /dev/null +++ b/tests/test-fopen.c @@ -0,0 +1,42 @@ +/* Test of opening a file stream. + Copyright (C) 2007 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 2, 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, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Bruno Haible , 2007. */ + +#include + +#include +#include + +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) + +int +main () +{ + ASSERT (fopen ("/dev/null", "r") != NULL); + + return 0; +}