index-of-nearest-104619 #2

Merged
Iliya Katushenock merged 62 commits from HooglyBoogly/blender:index-of-nearest-104619 into index_of_nearest 2023-04-20 21:19:53 +02:00
Showing only changes of commit b6e527febb - Show all commits

View File

@ -771,7 +771,7 @@ TEST(path_util, PathExtensionReplace)
{ {
PATH_EXTENSION_REPLACE("test", ".txt", true, "test.txt"); PATH_EXTENSION_REPLACE("test", ".txt", true, "test.txt");
PATH_EXTENSION_REPLACE("test.", ".txt", true, "test.txt"); PATH_EXTENSION_REPLACE("test.", ".txt", true, "test.txt");
/* Unlike #BLI_path_extension_ensure, exceeds '.' are not stripped. */ /* Unlike #BLI_path_extension_ensure, excess '.' are not stripped. */
PATH_EXTENSION_REPLACE("test..", ".txt", true, "test..txt"); PATH_EXTENSION_REPLACE("test..", ".txt", true, "test..txt");
PATH_EXTENSION_REPLACE("test.txt", ".txt", true, "test.txt"); PATH_EXTENSION_REPLACE("test.txt", ".txt", true, "test.txt");
@ -780,8 +780,15 @@ TEST(path_util, PathExtensionReplace)
PATH_EXTENSION_REPLACE("test", "_txt", true, "test_txt"); PATH_EXTENSION_REPLACE("test", "_txt", true, "test_txt");
PATH_EXTENSION_REPLACE("test.ext", "_txt", true, "test_txt"); PATH_EXTENSION_REPLACE("test.ext", "_txt", true, "test_txt");
PATH_EXTENSION_REPLACE("test", "", true, "test");
/* Same as #BLI_path_extension_strip. */
PATH_EXTENSION_REPLACE("test.txt", "", true, "test");
/* Empty strings. */
PATH_EXTENSION_REPLACE("test", "", true, "test"); PATH_EXTENSION_REPLACE("test", "", true, "test");
PATH_EXTENSION_REPLACE("", "_txt", true, "_txt"); PATH_EXTENSION_REPLACE("", "_txt", true, "_txt");
PATH_EXTENSION_REPLACE("", "", true, "");
/* Ensure leading '.' isn't treated as an extension. */ /* Ensure leading '.' isn't treated as an extension. */
PATH_EXTENSION_REPLACE(".hidden", ".hidden", true, ".hidden.hidden"); PATH_EXTENSION_REPLACE(".hidden", ".hidden", true, ".hidden.hidden");
@ -823,8 +830,13 @@ TEST(path_util, PathExtensionEnsure)
PATH_EXTENSION_ENSURE("test", "_txt", true, "test_txt"); PATH_EXTENSION_ENSURE("test", "_txt", true, "test_txt");
PATH_EXTENSION_ENSURE("test.ext", "_txt", true, "test.ext_txt"); PATH_EXTENSION_ENSURE("test.ext", "_txt", true, "test.ext_txt");
/* An empty string does nothing (unlike replace which strips). */
PATH_EXTENSION_ENSURE("test.txt", "", true, "test.txt");
/* Empty strings. */
PATH_EXTENSION_ENSURE("test", "", true, "test"); PATH_EXTENSION_ENSURE("test", "", true, "test");
PATH_EXTENSION_ENSURE("", "_txt", true, "_txt"); PATH_EXTENSION_ENSURE("", "_txt", true, "_txt");
PATH_EXTENSION_ENSURE("", "", true, "");
/* Ensure leading '.' isn't treated as an extension. */ /* Ensure leading '.' isn't treated as an extension. */
PATH_EXTENSION_ENSURE(".hidden", ".hidden", true, ".hidden.hidden"); PATH_EXTENSION_ENSURE(".hidden", ".hidden", true, ".hidden.hidden");