aboutsummaryrefslogtreecommitdiffstats
path: root/util/folder
diff options
context:
space:
mode:
authornalpp <nalpp@yandex-team.ru>2022-02-10 16:46:45 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:45 +0300
commit87f3eb38999df2d3c1cb77f8ffb9c52ec9c516fb (patch)
treef4ab0734eecf35b22f21952d1aa15496f267a6a3 /util/folder
parent198698b9c1e18958addc9682fbfba4576d604757 (diff)
downloadydb-87f3eb38999df2d3c1cb77f8ffb9c52ec9c516fb.tar.gz
Restoring authorship annotation for <nalpp@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/folder')
-rw-r--r--util/folder/path_ut.cpp140
1 files changed, 70 insertions, 70 deletions
diff --git a/util/folder/path_ut.cpp b/util/folder/path_ut.cpp
index e6a3451016..df67fc854f 100644
--- a/util/folder/path_ut.cpp
+++ b/util/folder/path_ut.cpp
@@ -1,7 +1,7 @@
#include "path.h"
#include "pathsplit.h"
-#include "dirut.h"
-#include "tempdir.h"
+#include "dirut.h"
+#include "tempdir.h"
#include <library/cpp/testing/unittest/registar.h>
@@ -9,8 +9,8 @@
#include <util/system/platform.h>
#include <util/system/yassert.h>
#include <util/stream/output.h>
-#include <util/stream/file.h>
-#include <util/system/fs.h>
+#include <util/stream/file.h>
+#include <util/system/fs.h>
#include <algorithm>
@@ -424,108 +424,108 @@ Y_UNIT_TEST_SUITE(TFsPathTests) {
TFsPath pathThree{"/a/b"};
UNIT_ASSERT_VALUES_EQUAL(ToString(pathThree), "/a/b");
}
-
-#ifdef _unix_
+
+#ifdef _unix_
Y_UNIT_TEST(TestRemoveSymlinkToDir) {
- TTempDir tempDir;
- TFsPath tempDirPath(tempDir());
-
+ TTempDir tempDir;
+ TFsPath tempDirPath(tempDir());
+
const TString originDir = tempDirPath.Child("origin");
- MakePathIfNotExist(originDir.c_str());
-
+ MakePathIfNotExist(originDir.c_str());
+
const TString originFile = TFsPath(originDir).Child("data");
- {
+ {
TFixedBufferFileOutput out(originFile);
- out << "data111!!!";
- }
-
+ out << "data111!!!";
+ }
+
const TString link = tempDirPath.Child("origin_symlink");
- NFs::SymLink(originDir, link);
-
- TFsPath(link).ForceDelete();
-
+ NFs::SymLink(originDir, link);
+
+ TFsPath(link).ForceDelete();
+
UNIT_ASSERT(!NFs::Exists(link));
UNIT_ASSERT(NFs::Exists(originFile));
UNIT_ASSERT(NFs::Exists(originDir));
- }
-
+ }
+
Y_UNIT_TEST(TestRemoveSymlinkToFile) {
- TTempDir tempDir;
- TFsPath tempDirPath(tempDir());
-
+ TTempDir tempDir;
+ TFsPath tempDirPath(tempDir());
+
const TString originDir = tempDirPath.Child("origin");
- MakePathIfNotExist(originDir.c_str());
-
+ MakePathIfNotExist(originDir.c_str());
+
const TString originFile = TFsPath(originDir).Child("data");
- {
+ {
TFixedBufferFileOutput out(originFile);
- out << "data111!!!";
- }
-
+ out << "data111!!!";
+ }
+
const TString link = tempDirPath.Child("origin_symlink");
- NFs::SymLink(originFile, link);
-
- TFsPath(link).ForceDelete();
-
+ NFs::SymLink(originFile, link);
+
+ TFsPath(link).ForceDelete();
+
UNIT_ASSERT(!NFs::Exists(link));
UNIT_ASSERT(NFs::Exists(originFile));
UNIT_ASSERT(NFs::Exists(originDir));
- }
-
+ }
+
Y_UNIT_TEST(TestRemoveDirWithSymlinkToDir) {
- TTempDir tempDir;
- TFsPath tempDirPath(tempDir());
-
+ TTempDir tempDir;
+ TFsPath tempDirPath(tempDir());
+
const TString symlinkedDir = tempDirPath.Child("to_remove");
- MakePathIfNotExist(symlinkedDir.c_str());
-
+ MakePathIfNotExist(symlinkedDir.c_str());
+
const TString originDir = tempDirPath.Child("origin");
- MakePathIfNotExist(originDir.c_str());
-
+ MakePathIfNotExist(originDir.c_str());
+
const TString originFile = TFsPath(originDir).Child("data");
- {
+ {
TFixedBufferFileOutput out(originFile);
- out << "data111!!!";
- }
-
+ out << "data111!!!";
+ }
+
const TString symlinkedFile = TFsPath(symlinkedDir).Child("origin_symlink");
- NFs::SymLink(originDir, symlinkedFile);
-
- TFsPath(symlinkedDir).ForceDelete();
-
+ NFs::SymLink(originDir, symlinkedFile);
+
+ TFsPath(symlinkedDir).ForceDelete();
+
UNIT_ASSERT(!NFs::Exists(symlinkedFile));
UNIT_ASSERT(!NFs::Exists(symlinkedDir));
UNIT_ASSERT(NFs::Exists(originFile));
UNIT_ASSERT(NFs::Exists(originDir));
- }
-
+ }
+
Y_UNIT_TEST(TestRemoveDirWithSymlinkToFile) {
- TTempDir tempDir;
- TFsPath tempDirPath(tempDir());
-
+ TTempDir tempDir;
+ TFsPath tempDirPath(tempDir());
+
const TString symlinkedDir = tempDirPath.Child("to_remove");
- MakePathIfNotExist(symlinkedDir.c_str());
-
+ MakePathIfNotExist(symlinkedDir.c_str());
+
const TString originDir = tempDirPath.Child("origin");
- MakePathIfNotExist(originDir.c_str());
-
+ MakePathIfNotExist(originDir.c_str());
+
const TString originFile = TFsPath(originDir).Child("data");
- {
+ {
TFixedBufferFileOutput out(originFile);
- out << "data111!!!";
- }
-
+ out << "data111!!!";
+ }
+
const TString symlinkedFile = TFsPath(symlinkedDir).Child("origin_symlink");
- NFs::SymLink(originFile, symlinkedFile);
-
- TFsPath(symlinkedDir).ForceDelete();
-
+ NFs::SymLink(originFile, symlinkedFile);
+
+ TFsPath(symlinkedDir).ForceDelete();
+
UNIT_ASSERT(!NFs::Exists(symlinkedFile));
UNIT_ASSERT(!NFs::Exists(symlinkedDir));
UNIT_ASSERT(NFs::Exists(originFile));
UNIT_ASSERT(NFs::Exists(originDir));
- }
-#endif
+ }
+#endif
Y_UNIT_TEST(TestForceDeleteNonexisting) {
TTempDir tempDir;