aboutsummaryrefslogtreecommitdiffstats
path: root/tests/stdio_ext_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/stdio_ext_test.cpp')
-rw-r--r--tests/stdio_ext_test.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/stdio_ext_test.cpp b/tests/stdio_ext_test.cpp
index 3dbc485a6..950c7ed06 100644
--- a/tests/stdio_ext_test.cpp
+++ b/tests/stdio_ext_test.cpp
@@ -34,7 +34,13 @@
TEST(stdio_ext, __fbufsize) {
FILE* fp = fopen("/proc/version", "r");
+ // Initially, there's no buffer in case the first thing you do is disable buffering.
+ ASSERT_EQ(0U, __fbufsize(fp));
+
+ // A read forces a buffer to be created.
char buf[128];
+ fgets(buf, sizeof(buf), fp);
+ ASSERT_EQ(1024U, __fbufsize(fp));
ASSERT_EQ(0, setvbuf(fp, buf, _IOFBF, 1));
ASSERT_EQ(1U, __fbufsize(fp));