commit 4bd7dfd61c38876b7e0050ca5001ab3100dffaba
parent 76ba324156336015937bf3a27397766c20eac191
Author: cfillion <cfillion@users.noreply.github.com>
Date: Wed, 6 Sep 2017 21:39:31 -0400
path: treat absolute and relative paths as always not equal
Diffstat:
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/path.cpp b/src/path.cpp
@@ -193,7 +193,7 @@ bool Path::startsWith(const Path &o) const
bool Path::operator==(const Path &o) const
{
- return m_parts == o.m_parts;
+ return m_absolute == o.absolute() && m_parts == o.m_parts;
}
bool Path::operator!=(const Path &o) const
diff --git a/test/path.cpp b/test/path.cpp
@@ -157,6 +157,10 @@ TEST_CASE("absolute path (unix)", M) {
REQUIRE(a[0] == "usr");
REQUIRE(a.join() == "/usr/bin/zsh");
}
+
+TEST_CASE("compare absolute to relative path (unix)", M) {
+ REQUIRE(Path("/a/b") != Path("a/b"));
+}
#endif
TEST_CASE("remove last component of path", M) {