created test case ustringNegativeTest to reproduce the issue #792
see http://bugs.campware.org/view.php?id=792
This commit is contained in:
parent
df3cd3f0cb
commit
9129b24e57
2 changed files with 43 additions and 3 deletions
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: maroy $
|
Author : $Author: maroy $
|
||||||
Version : $Revision: 1.4 $
|
Version : $Revision: 1.5 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/LocalizedObjectTest.cxx,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/LocalizedObjectTest.cxx,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -308,3 +308,33 @@ LocalizedObjectTest :: ustringTest(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Test the ustring related functions in problematic situations
|
||||||
|
* see http://bugs.campware.org/view.php?id=792
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
LocalizedObjectTest :: ustringNegativeTest(void)
|
||||||
|
throw (CPPUNIT_NS::Exception)
|
||||||
|
{
|
||||||
|
bool gotException;
|
||||||
|
UErrorCode status = U_ZERO_ERROR;
|
||||||
|
Ptr<ResourceBundle>::Ref bundle(new ResourceBundle("./tmp/" PACKAGE_NAME,
|
||||||
|
"root",
|
||||||
|
status));
|
||||||
|
CPPUNIT_ASSERT(U_SUCCESS(status));
|
||||||
|
|
||||||
|
// test getting a missing ustring resource
|
||||||
|
gotException = false;
|
||||||
|
try {
|
||||||
|
Ptr<LocalizedObject>::Ref locObj(new LocalizedObject(bundle));
|
||||||
|
Ptr<LocalizedObject>::Ref section1(new LocalizedObject(
|
||||||
|
locObj->getBundle("section1")));
|
||||||
|
Ptr<Glib::ustring>::Ref foo =
|
||||||
|
section1->getResourceUstring("nonexistentKey");
|
||||||
|
} catch (std::invalid_argument &e) {
|
||||||
|
gotException = true;
|
||||||
|
}
|
||||||
|
CPPUNIT_ASSERT(gotException);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: maroy $
|
Author : $Author: maroy $
|
||||||
Version : $Revision: 1.4 $
|
Version : $Revision: 1.5 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/LocalizedObjectTest.h,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/LocalizedObjectTest.h,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -58,7 +58,7 @@ namespace Core {
|
||||||
* Unit test for the LocalizedObject class.
|
* Unit test for the LocalizedObject class.
|
||||||
*
|
*
|
||||||
* @author $Author: maroy $
|
* @author $Author: maroy $
|
||||||
* @version $Revision: 1.4 $
|
* @version $Revision: 1.5 $
|
||||||
* @see LocalizedObject
|
* @see LocalizedObject
|
||||||
*/
|
*/
|
||||||
class LocalizedObjectTest : public CPPUNIT_NS::TestFixture
|
class LocalizedObjectTest : public CPPUNIT_NS::TestFixture
|
||||||
|
@ -70,6 +70,7 @@ class LocalizedObjectTest : public CPPUNIT_NS::TestFixture
|
||||||
CPPUNIT_TEST(formatMessageTest);
|
CPPUNIT_TEST(formatMessageTest);
|
||||||
CPPUNIT_TEST(loadFromConfigTest);
|
CPPUNIT_TEST(loadFromConfigTest);
|
||||||
CPPUNIT_TEST(ustringTest);
|
CPPUNIT_TEST(ustringTest);
|
||||||
|
CPPUNIT_TEST(ustringNegativeTest);
|
||||||
CPPUNIT_TEST_SUITE_END();
|
CPPUNIT_TEST_SUITE_END();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -124,6 +125,15 @@ class LocalizedObjectTest : public CPPUNIT_NS::TestFixture
|
||||||
void
|
void
|
||||||
ustringTest(void) throw (CPPUNIT_NS::Exception);
|
ustringTest(void) throw (CPPUNIT_NS::Exception);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A test to check the Glib::ustring related function beaviour
|
||||||
|
* in problematic situations.
|
||||||
|
*
|
||||||
|
* @exception CPPUNIT_NS::Exception on test failures.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
ustringNegativeTest(void) throw (CPPUNIT_NS::Exception);
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue