clang-format
This commit is contained in:
@@ -36,76 +36,61 @@
|
||||
|
||||
#include "test.h"
|
||||
|
||||
static
|
||||
void
|
||||
rename_dot(void)
|
||||
{
|
||||
int rv;
|
||||
static void rename_dot(void) {
|
||||
int rv;
|
||||
|
||||
report_begin("rename .");
|
||||
report_begin("rename .");
|
||||
|
||||
rv = rename(".", TESTDIR);
|
||||
report_check(rv, errno, EINVAL);
|
||||
if (rv==0) {
|
||||
/* oops... put it back */
|
||||
rename(TESTDIR, ".");
|
||||
}
|
||||
rv = rename(".", TESTDIR);
|
||||
report_check(rv, errno, EINVAL);
|
||||
if (rv == 0) {
|
||||
/* oops... put it back */
|
||||
rename(TESTDIR, ".");
|
||||
}
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
rename_dotdot(void)
|
||||
{
|
||||
int rv;
|
||||
static void rename_dotdot(void) {
|
||||
int rv;
|
||||
|
||||
report_begin("rename ..");
|
||||
rv = rename("..", TESTDIR);
|
||||
report_check(rv, errno, EINVAL);
|
||||
if (rv==0) {
|
||||
/* oops... put it back */
|
||||
rename(TESTDIR, "..");
|
||||
}
|
||||
report_begin("rename ..");
|
||||
rv = rename("..", TESTDIR);
|
||||
report_check(rv, errno, EINVAL);
|
||||
if (rv == 0) {
|
||||
/* oops... put it back */
|
||||
rename(TESTDIR, "..");
|
||||
}
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
rename_empty1(void)
|
||||
{
|
||||
int rv;
|
||||
static void rename_empty1(void) {
|
||||
int rv;
|
||||
|
||||
report_begin("rename empty string");
|
||||
rv = rename("", TESTDIR);
|
||||
report_check2(rv, errno, EISDIR, EINVAL);
|
||||
if (rv==0) {
|
||||
/* don't try to remove it */
|
||||
rename(TESTDIR, TESTDIR "-foo");
|
||||
}
|
||||
report_begin("rename empty string");
|
||||
rv = rename("", TESTDIR);
|
||||
report_check2(rv, errno, EISDIR, EINVAL);
|
||||
if (rv == 0) {
|
||||
/* don't try to remove it */
|
||||
rename(TESTDIR, TESTDIR "-foo");
|
||||
}
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
rename_empty2(void)
|
||||
{
|
||||
int rv;
|
||||
static void rename_empty2(void) {
|
||||
int rv;
|
||||
|
||||
report_begin("rename to empty string");
|
||||
if (create_testdir()<0) {
|
||||
/*report_aborted();*/ /* XXX in create_testdir */
|
||||
return;
|
||||
}
|
||||
rv = rename(TESTDIR, "");
|
||||
report_check2(rv, errno, EISDIR, EINVAL);
|
||||
rmdir(TESTDIR);
|
||||
report_begin("rename to empty string");
|
||||
if (create_testdir() < 0) {
|
||||
/*report_aborted();*/ /* XXX in create_testdir */
|
||||
return;
|
||||
}
|
||||
rv = rename(TESTDIR, "");
|
||||
report_check2(rv, errno, EISDIR, EINVAL);
|
||||
rmdir(TESTDIR);
|
||||
}
|
||||
|
||||
void
|
||||
test_rename(void)
|
||||
{
|
||||
test_rename_paths();
|
||||
void test_rename(void) {
|
||||
test_rename_paths();
|
||||
|
||||
rename_dot();
|
||||
rename_dotdot();
|
||||
rename_empty1();
|
||||
rename_empty2();
|
||||
rename_dot();
|
||||
rename_dotdot();
|
||||
rename_empty1();
|
||||
rename_empty2();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user