X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=tests%2Ftest-fopen.h;h=e1e7e17c668634e15d6992484bd9ffa7a99274d2;hb=43593319b31e6b0175b8eec4433bac744959822d;hp=01369f83c4439105492ba741b4e937eaa8af238d;hpb=ec65f38e49b3db77ef9866f888f0a8d743cfe742;p=gnulib.git diff --git a/tests/test-fopen.h b/tests/test-fopen.h index 01369f83c..e1e7e17c6 100644 --- a/tests/test-fopen.h +++ b/tests/test-fopen.h @@ -1,5 +1,5 @@ /* Test of opening a file stream. - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2013 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 @@ -19,20 +19,9 @@ /* Include and a form of first. */ #include -#include #include -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* Test fopen. Assumes BASE is defined. */ @@ -56,17 +45,18 @@ test_fopen (void) /* Trailing slash is invalid on non-directory. */ errno = 0; ASSERT (fopen (BASE "file/", "r") == NULL); - ASSERT (errno == ENOTDIR || errno == EISDIR); + ASSERT (errno == ENOTDIR || errno == EISDIR || errno == EINVAL); /* Cannot create a directory. */ errno = 0; ASSERT (fopen ("nonexist.ent/", "w") == NULL); - ASSERT (errno == ENOTDIR || errno == EISDIR || errno == ENOENT); + ASSERT (errno == ENOTDIR || errno == EISDIR || errno == ENOENT + || errno == EINVAL); /* Directories cannot be opened for writing. */ errno = 0; ASSERT (fopen (".", "w") == NULL); - ASSERT (errno == EISDIR || errno == EINVAL); + ASSERT (errno == EISDIR || errno == EINVAL || errno == EACCES); /* /dev/null must exist, and be writable. */ f = fopen ("/dev/null", "r");