From 796d0befe2160ed51bf551829bd351497e85072b Mon Sep 17 00:00:00 2001 From: Wengier Date: Tue, 23 Nov 2021 20:02:20 -0500 Subject: [PATCH] fix to pass tests --- src/dos/drives.cpp | 3 +-- tests/drives_tests.cpp | 12 ++++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/dos/drives.cpp b/src/dos/drives.cpp index 6122a0084..68100ac4b 100644 --- a/src/dos/drives.cpp +++ b/src/dos/drives.cpp @@ -222,6 +222,7 @@ void Set_Label(char const * const input, char * const output, bool cdrom) { togo--; } output[labelPos] = 0; + if((labelPos > 0) && (output[labelPos-1] == '.') && labelPos == 9) output[labelPos-1] = 0; return; } @@ -253,8 +254,6 @@ void Set_Label(char const * const input, char * const output, bool cdrom) { output[labelPos-1] = 0; } - - DOS_Drive::DOS_Drive() { nocachedir=false; readonly=false; diff --git a/tests/drives_tests.cpp b/tests/drives_tests.cpp index bbf4eaaa6..f8212b48b 100644 --- a/tests/drives_tests.cpp +++ b/tests/drives_tests.cpp @@ -55,8 +55,16 @@ TEST(WildFileCmp, WildDotWild) TEST(WildFileCmp, WildcardNoExt) { + bool oldlfn = uselfn; + uselfn = false; EXPECT_EQ(false, WildFileCmp("TEST.EXE", "*")); EXPECT_EQ(false, WildFileCmp(".EXE", "*")); + EXPECT_EQ(false, WildFileCmp("TEST.BAK", "T*")); + uselfn = true; + EXPECT_EQ(true, WildFileCmp("TEST.EXE", "*")); + EXPECT_EQ(true, WildFileCmp(".EXE", "*")); + EXPECT_EQ(true, WildFileCmp("TEST.BAK", "T*")); + uselfn = oldlfn; EXPECT_EQ(true, WildFileCmp("TEST", "*")); EXPECT_EQ(true, WildFileCmp("TEST", "T*")); EXPECT_EQ(false, WildFileCmp("TEST", "Z*")); @@ -80,7 +88,7 @@ TEST(WildFileCmp, QuestionMark) TEST(Set_Label, Daggerfall) { std::string output = run_Set_Label("Daggerfall", false); - EXPECT_EQ("DAGGERFA.LL", output); + EXPECT_EQ("DAGGERFALL", output); } TEST(Set_Label, DaggerfallCD) { @@ -91,7 +99,7 @@ TEST(Set_Label, DaggerfallCD) TEST(Set_Label, LongerThan11) { std::string output = run_Set_Label("a123456789AAA", false); - EXPECT_EQ("A1234567.89A", output); + EXPECT_EQ("A123456789A", output); } TEST(Set_Label, LongerThan11CD) {