aboutsummaryrefslogtreecommitdiff
path: root/test/engines/wintermute
diff options
context:
space:
mode:
authorTobia Tesan2016-12-26 10:42:29 +0100
committerTobia Tesan2016-12-26 12:02:56 +0100
commit93394902368a0fb2c25647f0d6205f5a43282933 (patch)
tree38e3a0cdcd27d234e8ba7084b122431007c6fb69 /test/engines/wintermute
parente3fdd8d5fe5b739b28c67539bbdb0b596f9dacbe (diff)
downloadscummvm-rg350-93394902368a0fb2c25647f0d6205f5a43282933.tar.gz
scummvm-rg350-93394902368a0fb2c25647f0d6205f5a43282933.tar.bz2
scummvm-rg350-93394902368a0fb2c25647f0d6205f5a43282933.zip
WINTERMUTE: only access -1th char of string if length > 0 in getFileName
Fixes #6594
Diffstat (limited to 'test/engines/wintermute')
-rw-r--r--test/engines/wintermute/path_utils.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/engines/wintermute/path_utils.h b/test/engines/wintermute/path_utils.h
index c3f1776231..3cacf47fd9 100644
--- a/test/engines/wintermute/path_utils.h
+++ b/test/engines/wintermute/path_utils.h
@@ -53,6 +53,10 @@ class PathUtilTestSuite : public CxxTest::TestSuite {
Wintermute::PathUtil::getDirectoryName(windowsCapPath),
Common::String("C:\\SOME\\")
);
+ TS_ASSERT_EQUALS(
+ Wintermute::PathUtil::getDirectoryName(emptyString),
+ Common::String("")
+ );
}
void test_getfilename() {
@@ -73,6 +77,10 @@ class PathUtilTestSuite : public CxxTest::TestSuite {
Common::String("FILE.EXT")
);
TS_ASSERT_EQUALS(
+ Wintermute::PathUtil::getFileName(emptyString),
+ Common::String("")
+ );
+ TS_ASSERT_EQUALS(
Wintermute::PathUtil::getFileName(unixRelativePath),
Common::String("file.ext")
);
@@ -80,6 +88,14 @@ class PathUtilTestSuite : public CxxTest::TestSuite {
Wintermute::PathUtil::getFileName(windowsRelativePath),
Common::String("file.ext")
);
+ TS_ASSERT_EQUALS(
+ Wintermute::PathUtil::getFileName(windowsDirPath),
+ Common::String("")
+ );
+ TS_ASSERT_EQUALS(
+ Wintermute::PathUtil::getFileName(unixDirPath),
+ Common::String("")
+ );
}
void test_getextension() {
@@ -92,6 +108,10 @@ class PathUtilTestSuite : public CxxTest::TestSuite {
Common::String("EXT")
);
TS_ASSERT_EQUALS(
+ Wintermute::PathUtil::getExtension(emptyString),
+ Common::String("")
+ );
+ TS_ASSERT_EQUALS(
Wintermute::PathUtil::getExtension(dualExtPath),
Common::String("gz")
);
@@ -119,6 +139,10 @@ class PathUtilTestSuite : public CxxTest::TestSuite {
Common::String("FILE")
);
TS_ASSERT_EQUALS(
+ Wintermute::PathUtil::getFileNameWithoutExtension(emptyString),
+ Common::String("")
+ );
+ TS_ASSERT_EQUALS(
Wintermute::PathUtil::getFileNameWithoutExtension(dualExtPath),
Common::String("file.tar")
);