summaryrefslogtreecommitdiffstats
path: root/tests/unistd_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unistd_test.cpp')
-rw-r--r--tests/unistd_test.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/unistd_test.cpp b/tests/unistd_test.cpp
index f54a461..a21578a 100644
--- a/tests/unistd_test.cpp
+++ b/tests/unistd_test.cpp
@@ -176,6 +176,15 @@ TEST(unistd, ftruncate64) {
ASSERT_EQ(123, sb.st_size);
}
+TEST(unistd, ftruncate_negative) {
+ TemporaryFile tf;
+ errno = 0;
+ int rc = ftruncate(tf.fd, -123);
+ int err = errno;
+ ASSERT_EQ(-1, rc);
+ ASSERT_EQ(EINVAL, err);
+}
+
static bool g_pause_test_flag = false;
static void PauseTestSignalHandler(int) {
g_pause_test_flag = true;