summaryrefslogtreecommitdiff
path: root/src/unittests
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2019-03-07 02:11:23 +0300
committerAndrei Karas <akaras@inbox.ru>2019-03-07 04:43:13 +0300
commit6b7551264a65f4e9d330a79a9a917a3febd2de44 (patch)
treeee2a50dbb4c61a2438b285cf6970a50fc811b911 /src/unittests
parentd459087cfef054b9172836dde6c2f433d2aecbc7 (diff)
downloadmv-6b7551264a65f4e9d330a79a9a917a3febd2de44.tar.gz
mv-6b7551264a65f4e9d330a79a9a917a3febd2de44.tar.bz2
mv-6b7551264a65f4e9d330a79a9a917a3febd2de44.tar.xz
mv-6b7551264a65f4e9d330a79a9a917a3febd2de44.zip
Add function for find first right separator
Diffstat (limited to 'src/unittests')
-rw-r--r--src/unittests/utils/stringutils.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/unittests/utils/stringutils.cc b/src/unittests/utils/stringutils.cc
index 0a865d633..cf0fb9764 100644
--- a/src/unittests/utils/stringutils.cc
+++ b/src/unittests/utils/stringutils.cc
@@ -1451,6 +1451,27 @@ TEST_CASE("stringuntils secureChatCommand", "")
REQUIRE(str == "_#test");
}
+TEST_CASE("stringuntils rfindSepatator", "")
+{
+ REQUIRE(rfindSepatator("test1") == std::string("test1").rfind('/'));
+ REQUIRE(rfindSepatator("test2/") == std::string("test2/").rfind('/'));
+ REQUIRE(rfindSepatator("test3\\") == std::string("test3\\").rfind('\\'));
+ REQUIRE(rfindSepatator("test4/qqq") ==
+ std::string("test4/qqq").rfind('/'));
+ REQUIRE(rfindSepatator("test5\\qqq") ==
+ std::string("test5\\qqq").rfind('\\'));
+ REQUIRE(rfindSepatator("test6/qqq/www") ==
+ std::string("test6/qqq/www").rfind('/'));
+ REQUIRE(rfindSepatator("test7\\qqq\\www") ==
+ std::string("test7\\qqq\\www").rfind('\\'));
+ REQUIRE(rfindSepatator("/test8") == std::string("/test8").rfind('/'));
+ REQUIRE(rfindSepatator("\\test9") == std::string("\\test9").rfind('\\'));
+ REQUIRE(rfindSepatator("test10/qqq\\www") ==
+ std::string("test10/qqq\\www").rfind('\\'));
+ REQUIRE(rfindSepatator("test11\\qqq/www") ==
+ std::string("test11\\qqq/www").rfind('/'));
+}
+
#ifdef ENABLE_NLS
TEST_CASE("stringuntils timeDiffToString", "")
{