Skip to content

Commit

Permalink
Rename new function
Browse files Browse the repository at this point in the history
  • Loading branch information
pitrou committed Mar 7, 2024
1 parent 5c83fde commit 2e802ff
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 20 deletions.
28 changes: 14 additions & 14 deletions cpp/src/arrow/filesystem/filesystem_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -152,32 +152,32 @@ TEST(PathUtil, GetAbstractPathParent) {
AssertPairEqual(pair, {"abc", "def\\ghi"});
}

TEST(PathUtil, ValidateAbstractPathPartsString) {
ASSERT_OK(ValidateAbstractPathParts(""));
ASSERT_OK(ValidateAbstractPathParts("abc"));
ASSERT_OK(ValidateAbstractPathParts("abc/def"));
ASSERT_OK(ValidateAbstractPathParts("abc/def.ghi"));
ASSERT_OK(ValidateAbstractPathParts("abc/def\\ghi"));
TEST(PathUtil, ValidateAbstractPath) {
ASSERT_OK(ValidateAbstractPath(""));
ASSERT_OK(ValidateAbstractPath("abc"));
ASSERT_OK(ValidateAbstractPath("abc/def"));
ASSERT_OK(ValidateAbstractPath("abc/def.ghi"));
ASSERT_OK(ValidateAbstractPath("abc/def\\ghi"));

// Extraneous separators
ASSERT_RAISES(Invalid, ValidateAbstractPathParts("//"));
ASSERT_RAISES(Invalid, ValidateAbstractPathParts("abc//def"));
ASSERT_RAISES(Invalid, ValidateAbstractPath("//"));
ASSERT_RAISES(Invalid, ValidateAbstractPath("abc//def"));
}

TEST(PathUtil, ValidateAbstractPathPartsVector) {
ASSERT_OK(ValidateAbstractPathParts(std::vector<std::string>{}));
ASSERT_OK(ValidateAbstractPathParts(std::vector<std::string>{"abc"}));
TEST(PathUtil, ValidateAbstractPathParts) {
ASSERT_OK(ValidateAbstractPathParts({}));
ASSERT_OK(ValidateAbstractPathParts({"abc"}));
ASSERT_OK(ValidateAbstractPathParts({"abc", "def"}));
ASSERT_OK(ValidateAbstractPathParts({"abc", "def.ghi"}));
ASSERT_OK(ValidateAbstractPathParts({"abc", "def\\ghi"}));

// Empty path component
ASSERT_RAISES(Invalid, ValidateAbstractPathParts(std::vector<std::string>{""}));
ASSERT_RAISES(Invalid, ValidateAbstractPathParts({""}));
ASSERT_RAISES(Invalid, ValidateAbstractPathParts({"abc", "", "def"}));

// Separator in component
ASSERT_RAISES(Invalid, ValidateAbstractPathParts(std::vector<std::string>{"/"}));
ASSERT_RAISES(Invalid, ValidateAbstractPathParts(std::vector<std::string>{"abc/def"}));
ASSERT_RAISES(Invalid, ValidateAbstractPathParts({"/"}));
ASSERT_RAISES(Invalid, ValidateAbstractPathParts({"abc/def"}));
}

TEST(PathUtil, ConcatAbstractPath) {
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/filesystem/gcsfs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ struct GcsPath {
}

static Status Validate(const GcsPath& path) {
auto st = internal::ValidateAbstractPathParts(path.full_path);
auto st = internal::ValidateAbstractPath(path.full_path);
if (!st.ok()) {
return Status::Invalid(st.message(), " in path ", path.full_path);
}
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/filesystem/path_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ Status ValidateAbstractPathParts(const std::vector<std::string>& parts) {
return Status::OK();
}

Status ValidateAbstractPathParts(std::string_view path) {
Status ValidateAbstractPath(std::string_view path) {
auto pos = path.find_first_of(kSep);
while (pos != path.npos) {
++pos;
Expand Down
6 changes: 3 additions & 3 deletions cpp/src/arrow/filesystem/path_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ ARROW_EXPORT int GetAbstractPathDepth(std::string_view path);
ARROW_EXPORT
std::pair<std::string, std::string> GetAbstractPathParent(const std::string& s);

// Validate the components of an abstract path.
// Validate an abstract path.
ARROW_EXPORT
Status ValidateAbstractPathParts(const std::vector<std::string>& parts);
Status ValidateAbstractPath(std::string_view path);

// Validate the components of an abstract path.
ARROW_EXPORT
Status ValidateAbstractPathParts(std::string_view path);
Status ValidateAbstractPathParts(const std::vector<std::string>& parts);

// Append a non-empty stem to an abstract path.
ARROW_EXPORT
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/filesystem/s3fs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ struct S3Path {
}

static Status Validate(const S3Path& path) {
auto st = internal::ValidateAbstractPathParts(path.full_path);
auto st = internal::ValidateAbstractPath(path.full_path);
if (!st.ok()) {
return Status::Invalid(st.message(), " in path ", path.full_path);
}
Expand Down

0 comments on commit 2e802ff

Please sign in to comment.