aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alexander Batischev <eual.jp@gmail.com> 2024-10-01 19:54:22 +0300
committerGravatar Alexander Batischev <eual.jp@gmail.com> 2024-11-22 20:48:31 +0300
commit2b6964020e2eecd0a01e8b27857902a439b32272 (patch)
tree388151404526e67fbf94d0de0328f7e71146bbd3
parente1ff2e8457269429cf646b51881675ddc087e8ea (diff)
downloadnewsboat-2b6964020e2eecd0a01e8b27857902a439b32272.tar.gz
newsboat-2b6964020e2eecd0a01e8b27857902a439b32272.tar.zst
newsboat-2b6964020e2eecd0a01e8b27857902a439b32272.zip
Remove implicit Filepath conversions from Filepath tests
-rw-r--r--test/filepath.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/test/filepath.cpp b/test/filepath.cpp
index 16ebb75f..81a26eb4 100644
--- a/test/filepath.cpp
+++ b/test/filepath.cpp
@@ -1,5 +1,3 @@
-#define ENABLE_IMPLICIT_FILEPATH_CONVERSIONS
-
#include "3rd-party/catch.hpp"
#include "filepath.h"
@@ -47,7 +45,10 @@ TEST_CASE("Can be extended with join()", "[Filepath]")
{
const auto tmp = Filepath::from_locale_string("/tmp");
- const auto subdir = tmp.join("newsboat").join("tests");
+ const auto subdir =
+ tmp
+ .join(Filepath::from_locale_string("newsboat"))
+ .join(Filepath::from_locale_string("tests"));
REQUIRE(subdir == Filepath::from_locale_string("/tmp/newsboat/tests"));
}
@@ -84,11 +85,11 @@ TEST_CASE("Can't set extension for an empty path", "[Filepath]")
TEST_CASE("Can set extension for non-empty path", "[Filepath]")
{
- Filepath path("file");
+ auto path = Filepath::from_locale_string("file");
SECTION("extension is UTF-8") {
REQUIRE(path.set_extension("exe"));
- REQUIRE(path == "file.exe");
+ REQUIRE(path == Filepath::from_locale_string("file.exe"));
}
SECTION("extension is not a valid UTF-8 string") {
@@ -105,21 +106,21 @@ TEST_CASE("Can check if path is absolute", "[Filepath]")
}
SECTION("path that starts with a slash is absolute") {
- path.push("/etc");
+ path.push(Filepath::from_locale_string("/etc"));
REQUIRE(path.display() == "/etc");
REQUIRE(path.is_absolute());
- path.push("ca-certificates");
+ path.push(Filepath::from_locale_string("ca-certificates"));
REQUIRE(path.display() == "/etc/ca-certificates");
REQUIRE(path.is_absolute());
}
SECTION("path that doesn't start with a slash is not absolute") {
- path.push("vmlinuz");
+ path.push(Filepath::from_locale_string("vmlinuz"));
REQUIRE(path.display() == "vmlinuz");
REQUIRE_FALSE(path.is_absolute());
- path.push("undefined");
+ path.push(Filepath::from_locale_string("undefined"));
REQUIRE(path.display() == "vmlinuz/undefined");
REQUIRE_FALSE(path.is_absolute());
}