Files
serenity/Tests/LibC/TestTruncate.cpp
Lucas Chollet b7b8874f54 LibC: Do not create files in truncate
This is not required by POSIX, and ENOENT seems more natural here. This
fixes a libcxx test.
2026-08-23 12:16:10 +02:00

17 lines
329 B
C++

/*
* Copyright (c) 2026, Lucas Chollet <[email protected]>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <AK/ByteString.h>
#include <LibTest/TestCase.h>
#include <unistd.h>
TEST_CASE(truncate_no_file)
{
int rc = truncate("/tmp/i_do_not_exist", 42);
EXPECT(rc < 0);
EXPECT(errno == ENOENT);
}