diff options
author | ShadowNinja <shadowninja@minetest.net> | 2022-01-29 22:48:41 -0500 |
---|---|---|
committer | rubenwardy <rw@rubenwardy.com> | 2022-04-08 14:55:21 +0100 |
commit | 65fdc7ae50adaee6116ed768d9f96e8732c96b85 (patch) | |
tree | fa613fd0bda94a5f1b16b25fd4b62582a389efd8 /src | |
parent | 00ebedad933244dbb866198b5769309ea011719c (diff) | |
download | minetest-65fdc7ae50adaee6116ed768d9f96e8732c96b85.tar.gz minetest-65fdc7ae50adaee6116ed768d9f96e8732c96b85.tar.bz2 minetest-65fdc7ae50adaee6116ed768d9f96e8732c96b85.zip |
Add tests for sanitizeDirName
Diffstat (limited to 'src')
-rw-r--r-- | src/unittest/test_utilities.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/unittest/test_utilities.cpp b/src/unittest/test_utilities.cpp index 743fe4462..228a9559f 100644 --- a/src/unittest/test_utilities.cpp +++ b/src/unittest/test_utilities.cpp @@ -58,6 +58,7 @@ public: void testStringJoin(); void testEulerConversion(); void testBase64(); + void testSanitizeDirName(); }; static TestUtilities g_test_instance; @@ -90,6 +91,7 @@ void TestUtilities::runTests(IGameDef *gamedef) TEST(testStringJoin); TEST(testEulerConversion); TEST(testBase64); + TEST(testSanitizeDirName); } //////////////////////////////////////////////////////////////////////////////// @@ -630,3 +632,12 @@ void TestUtilities::testBase64() UASSERT(base64_is_valid("AAAA=A") == false); UASSERT(base64_is_valid("AAAAA=A") == false); } + + +void TestUtilities::testSanitizeDirName() +{ + UASSERT(sanitizeDirName("a", "_") == "a"); + UASSERT(sanitizeDirName("COM1", "_") == "_COM1"); + UASSERT(sanitizeDirName("cOm\u00B2 .txt:a", "_") == "cOm\u00B2 _txt_a"); + UASSERT(sanitizeDirName("cOnIn$ ", "_") == "_cOnIn$ "); +} |