projects
/
gnulib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Tests for module 'unictype/joininggroup-byname'.
[gnulib.git]
/
tests
/
test-fopen.h
diff --git
a/tests/test-fopen.h
b/tests/test-fopen.h
index
01369f8
..
49cbac1
100644
(file)
--- a/
tests/test-fopen.h
+++ b/
tests/test-fopen.h
@@
-1,5
+1,5
@@
/* Test of opening a file stream.
/* Test of opening a file stream.
- Copyright (C) 2007-20
09
Free Software Foundation, Inc.
+ Copyright (C) 2007-20
11
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
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 <config.h> and a form of <stdio.h> first. */
#include <errno.h>
/* Include <config.h> and a form of <stdio.h> first. */
#include <errno.h>
-#include <stdlib.h>
#include <unistd.h>
#include <unistd.h>
-#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. */
/* 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);
/* 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);
/* 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);
/* 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");
/* /dev/null must exist, and be writable. */
f = fopen ("/dev/null", "r");