diff --git a/src/core/platform.h b/src/core/platform.h index ba40bcc..7667c26 100644 --- a/src/core/platform.h +++ b/src/core/platform.h @@ -335,7 +335,7 @@ // RTEMS errors are probably just a buildsys issue & this will change or go away. // Redox will probably implement this in the future. -#define CAN_UNLINK_WHILE_OPEN (!IS_AROS && !IS_RISCOS && !IS_REDOX) +#define CAN_UNLINK_WHILE_OPEN (!IS_AROS && !IS_RISCOS && !IS_REDOX && !IS_DOS_DJGPP) #define SUPPORTS_DOUBLE_SLASH_PATH (IS_CYGWIN) // POSIX standard says paths beginning with 2 slashes are "implementation defined" diff --git a/src/twtest/archive_t.cpp b/src/twtest/archive_t.cpp index cf6410f..260ec4b 100644 --- a/src/twtest/archive_t.cpp +++ b/src/twtest/archive_t.cpp @@ -38,6 +38,7 @@ #include "core/archive.h" #include "twtest/test.h" #include "core/error.h" +#include "tw/twutil.h" #include TSS_EXCEPTION(eTestArchiveError, eError); @@ -119,6 +120,12 @@ void TestLockedTemporaryArchive() lockedArch.OpenReadWrite(); lockedArch.Close(); } + catch (eError& e) + { + threw=true; + TCERR << "Error opening locked temp archive" << std::endl; + cTWUtil::PrintErrorMsg(e); + } catch (...) { threw = true; @@ -142,6 +149,12 @@ void TestLockedTemporaryArchive() // this should delete the file lockedArch.Close(); } + catch (eError& e) + { + threw=true; + TCERR << "Error writing locked temp archive" << std::endl; + cTWUtil::PrintErrorMsg(e); + } catch (...) { threw = true; @@ -215,6 +228,6 @@ void TestFileArchive() void RegisterSuite_Archive() { RegisterTest("Archive", "MemoryArchive", TestMemoryArchive); - RegisterTest("Archive", "LockedTemporaryArchive)", TestLockedTemporaryArchive); + RegisterTest("Archive", "LockedTemporaryArchive", TestLockedTemporaryArchive); RegisterTest("Archive", "FileArchive", TestFileArchive); } diff --git a/src/twtest/charutil_t.cpp b/src/twtest/charutil_t.cpp index 13d7c38..79166b7 100644 --- a/src/twtest/charutil_t.cpp +++ b/src/twtest/charutil_t.cpp @@ -42,6 +42,21 @@ #include "core/errorbucketimpl.h" #include "twtest/test.h" +#include + +bool localeIsUtf8() +{ + std::string locale(setlocale(LC_CTYPE, 0)); + std::transform(locale.begin(), locale.end(), locale.begin(), ::tolower); + + if(locale.find("utf-8") != std::string::npos) + return true; + + if(locale.find("utf8") != std::string::npos) + return true; + + return false; +} void CheckChars( const TSTRING& str, int length_expected = 1) { @@ -52,6 +67,8 @@ void CheckChars( const TSTRING& str, int length_expected = 1) while( cCharUtil::PopNextChar( cur, end, first, last ) ) { int length = (int)(last - first); + if (length != length_expected ) + TCERR << "CheckChars on '" << str << "' : expected = " << length_expected << " | observed = " << length << std::endl; TEST(length == length_expected); } } @@ -63,7 +80,11 @@ void TestCharUtilBasic() { CheckChars( "foo" ); CheckChars( "fo\x23 54" ); - CheckChars( "\U0001F408", 4 ); //Cat emoji. Assumes UTF-8 + + if(localeIsUtf8()) + CheckChars( "\U0001F408", 4 ); //Cat emoji, if UTF-8 + else + CheckChars( "\U0001F408", 1 ); // just a bag of bytes otherwise } void RegisterSuite_CharUtil() diff --git a/src/twtest/platform_t.cpp b/src/twtest/platform_t.cpp index fffdf4d..ccfd667 100644 --- a/src/twtest/platform_t.cpp +++ b/src/twtest/platform_t.cpp @@ -246,7 +246,7 @@ const TSTRING expected_os("Darwin"); #elif IS_CYGWIN const TSTRING expected_os("Cygwin"); #elif IS_DOS_DJGPP -const TSTRING expected_os("DJGPP"); +const TSTRING expected_os("FreeDOS"); // This will likely fail for other DOS flavors #elif IS_ANDROID const TSTRING expected_os("Android"); #elif IS_DRAGONFLYBSD @@ -308,6 +308,10 @@ void TestPlatformDetection() TEST( uname(&os_info) == 0); TSTRING observed_os(os_info.sysname); + + if ( observed_os != expected_os ) + TCERR << "Expected OS: " << expected_os << " | Observed OS: " << observed_os << std::endl; + TEST( observed_os == expected_os ); #endif } diff --git a/src/twtest/tasktimer_t.cpp b/src/twtest/tasktimer_t.cpp index ae774bd..b702093 100644 --- a/src/twtest/tasktimer_t.cpp +++ b/src/twtest/tasktimer_t.cpp @@ -53,7 +53,7 @@ void TestTaskTimer() } TEST(!timer.IsRunning()); - TEST(5 >= timer.GetTotalTime()); + TEST(5 <= timer.GetTotalTime()); TEST(5 == timer.GetNumTimesStarted()); }