diff options
author | 2024-10-02 20:56:15 +0300 | |
---|---|---|
committer | 2024-11-22 20:48:31 +0300 | |
commit | 71a87f8f41c191f4144a556f9158f17640cd5ad6 (patch) | |
tree | f1ef57f4dddc20b6e62ff94e9fe3a016e7c6478b /test/filepath.cpp | |
parent | d10223da75cc43fc3ce084cfc8eb6439311cd073 (diff) | |
download | newsboat-71a87f8f41c191f4144a556f9158f17640cd5ad6.tar.gz newsboat-71a87f8f41c191f4144a556f9158f17640cd5ad6.tar.zst newsboat-71a87f8f41c191f4144a556f9158f17640cd5ad6.zip |
Remove some implicit Filepath conversions from {File,Dir}BrowserFormAction
Diffstat (limited to 'test/filepath.cpp')
-rw-r--r-- | test/filepath.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/filepath.cpp b/test/filepath.cpp index 81a26eb4..a0d05ba3 100644 --- a/test/filepath.cpp +++ b/test/filepath.cpp @@ -41,6 +41,14 @@ TEST_CASE("push() adds a new component to the path", "[Filepath]") REQUIRE(dir == Filepath::from_locale_string("/tmp/newsboat/.local/share/cache/cache.db")); } +TEST_CASE("push() still adds a separator to non-empty path if new component is empty", + "[Filepath]") +{ + auto dir = Filepath::from_locale_string("/root"); + dir.push(Filepath::from_locale_string("")); + REQUIRE(dir.display() == "/root/"); +} + TEST_CASE("Can be extended with join()", "[Filepath]") { const auto tmp = Filepath::from_locale_string("/tmp"); @@ -52,6 +60,14 @@ TEST_CASE("Can be extended with join()", "[Filepath]") REQUIRE(subdir == Filepath::from_locale_string("/tmp/newsboat/tests")); } +TEST_CASE("join() still adds a separator to non-empty path if new component is empty", + "[Filepath]") +{ + const auto path = Filepath::from_locale_string("relative path"); + const auto path_with_trailing_slash = path.join(Filepath{}); + REQUIRE(path_with_trailing_slash.display() == "relative path/"); +} + TEST_CASE("Can be copied", "[Filepath]") { auto original = Filepath::from_locale_string("/etc/hosts"); |