diff options
Diffstat (limited to 'tests/stdio_test.cpp')
-rw-r--r-- | tests/stdio_test.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/stdio_test.cpp b/tests/stdio_test.cpp index 196c725aa..7569d04fe 100644 --- a/tests/stdio_test.cpp +++ b/tests/stdio_test.cpp @@ -185,3 +185,15 @@ TEST(stdio, printf_ssize_t) { snprintf(buf, sizeof(buf), "%zd", v); #endif } + +TEST(stdio, popen) { + FILE* fp = popen("cat /proc/version", "r"); + ASSERT_TRUE(fp != NULL); + + char buf[16]; + char* s = fgets(buf, sizeof(buf), fp); + buf[13] = '\0'; + ASSERT_STREQ("Linux version", s); + + ASSERT_EQ(0, pclose(fp)); +} |