Ifdef a test case that doesn't work w/ gxlc; add a test to verify exception handing works, because we've seen it not work

This commit is contained in:
Brian Cox 2018-09-25 01:11:46 -07:00
parent 84983b13d4
commit b2e7db6ba9
2 changed files with 24 additions and 0 deletions

View File

@ -57,7 +57,12 @@ void TestGenreSwitcher()
genreSwitcher->SelectGenre(cFS::GenreID());
TEST(genreSwitcher->CurrentGenre() == cFS::GenreID());
#ifndef HAVE_IBM_GXLC
// this fails on IBM XLC; the type_info::name() for the factory instance arg
// returns a blank string.
TEST(typeid(*iTWFactory::GetInstance()) == typeid(cFSFactory));
#endif
d.TraceDebug("All tests passed.\n");
}

View File

@ -206,6 +206,24 @@ void TestFileDelete()
TEST(iFSServices::GetInstance()->FileDelete(to_rm));
}
// This looks silly, but we've run into situations where basic exception handling fails due to
// fun linker issues, so here's a test to verify that we were built correctly.
void TestCatch()
{
bool threw = false;
try
{
throw eFSServices("a thing happened");
}
catch (const eFSServices& e)
{
threw = true;
}
TEST(threw);
}
void RegisterSuite_UnixFSServices()
{
RegisterTest("UnixFSServices", "ReadDir", TestReadDir);
@ -219,4 +237,5 @@ void RegisterSuite_UnixFSServices()
RegisterTest("UnixFSServices", "GetExecutableFilename", TestGetExecutableFilename);
RegisterTest("UnixFSServices", "Rename", TestRename);
RegisterTest("UnixFSServices", "FileDelete", TestFileDelete);
RegisterTest("UnixFSServices", "TestCatch", TestCatch);
}