summaryrefslogtreecommitdiff
path: root/tests/stdio_ext_test.cpp
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2018-02-14 15:21:45 -0800
committerElliott Hughes <enh@google.com>2018-02-14 15:25:21 -0800
commit457852666cb870a844df016962fac487cb5e7559 (patch)
treeb6d5ea190fca3841b956dc1cbe714fdef8982655 /tests/stdio_ext_test.cpp
parent38a78728c343f6398763ae8d7e3e8202b927a056 (diff)
Add __fseterr.
Trivial, obvious counterpart to the standard ferror(3) and clearerr(3), and lets us build bison out of the box. Bug: http://b/64273806 Test: ran tests Change-Id: I20affabddb71210051165c41e86adfe5ae04f77f
Diffstat (limited to 'tests/stdio_ext_test.cpp')
-rw-r--r--tests/stdio_ext_test.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/stdio_ext_test.cpp b/tests/stdio_ext_test.cpp
index 128e25558..849bf0bc1 100644
--- a/tests/stdio_ext_test.cpp
+++ b/tests/stdio_ext_test.cpp
@@ -190,6 +190,22 @@ TEST(stdio_ext, __freading__fwriting) {
}
}
+TEST(stdio_ext, __fseterr) {
+#if defined(__GLIBC__)
+ GTEST_LOG_(INFO) << "glibc doesn't have __fseterr, but gnulib will use it";
+#else
+ FILE* fp = fopen("/dev/null", "w");
+
+ ASSERT_FALSE(ferror(fp));
+ __fseterr(fp);
+ ASSERT_TRUE(ferror(fp));
+ clearerr(fp);
+ ASSERT_FALSE(ferror(fp));
+
+ fclose(fp);
+#endif
+}
+
TEST(stdio_ext, __fsetlocking) {
FILE* fp = fopen("/proc/version", "r");
ASSERT_EQ(FSETLOCKING_INTERNAL, __fsetlocking(fp, FSETLOCKING_QUERY));