aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/libutil/tests/tests.cc6
-rw-r--r--src/libutil/util.hh2
2 files changed, 3 insertions, 5 deletions
diff --git a/src/libutil/tests/tests.cc b/src/libutil/tests/tests.cc
index 1b016430d..d46f6a5a4 100644
--- a/src/libutil/tests/tests.cc
+++ b/src/libutil/tests/tests.cc
@@ -127,11 +127,9 @@ namespace nix {
ASSERT_EQ(p1, "");
}
- // XXX: according to the doc of `baseNameOf`, baseNameOf("/dir/") should return
- // "" but it actually returns "dir"
- TEST(baseNameOf, DISABLED_trailingSlash) {
+ TEST(baseNameOf, trailingSlash) {
auto p1 = baseNameOf("/dir/");
- ASSERT_EQ(p1, "");
+ ASSERT_EQ(p1, "dir");
}
/* ----------------------------------------------------------------------------
diff --git a/src/libutil/util.hh b/src/libutil/util.hh
index 38a0f7a5c..a63ee05b3 100644
--- a/src/libutil/util.hh
+++ b/src/libutil/util.hh
@@ -63,7 +63,7 @@ Path canonPath(const Path & path, bool resolveSymlinks = false);
Path dirOf(const Path & path);
/* Return the base name of the given canonical path, i.e., everything
- following the final `/'. */
+ following the final `/' (trailing slashes are removed). */
std::string_view baseNameOf(std::string_view path);
/* Check whether 'path' is a descendant of 'dir'. */