ICU-1048 fix compound inverses with parenthesized atoms

X-SVN-Rev: 5510
This commit is contained in:
Alan Liu 2001-08-17 17:22:26 +00:00
parent 69e092674f
commit d126a41693
3 changed files with 29 additions and 0 deletions

View File

@ -925,6 +925,11 @@ Transliterator* Transliterator::parseID(const UnicodeString& ID,
}
// assert(revLimit < ID.length() && ID.charAt(revLimit) == ')');
limit = revLimit+1;
} else {
// Ignore () exprs outside of this atomic ID, that is, in
// "Greek-Latin; Title()", ignore the "()" after Title when
// parsing Greek-Latin.
revStart = -1;
}
// Advance limit past /\s*;?\s*/

View File

@ -70,6 +70,7 @@ TransliteratorTest::runIndexedTest(int32_t index, UBool exec,
TESTCASE(34,TestSupplemental);
TESTCASE(35,TestQuantifier);
TESTCASE(36,TestSTV);
TESTCASE(37,TestCompoundInverse);
default: name = ""; break;
}
}
@ -1624,6 +1625,27 @@ void TransliteratorTest::TestSTV(void) {
}
}
/**
* Test inverse of Greek-Latin; Title()
*/
void TransliteratorTest::TestCompoundInverse(void) {
Transliterator *t = Transliterator::createInstance
("Greek-Latin; Title()", UTRANS_REVERSE);
if (t == 0) {
errln("FAIL: crateInstance");
return;
}
UnicodeString exp("(Title);Latin-Greek");
if (t->getID() == exp) {
logln("Ok: inverse of \"Greek-Latin; Title()\" is \"" +
t->getID());
} else {
errln("FAIL: inverse of \"Greek-Latin; Title()\" is \"" +
t->getID() + "\", expected \"" + exp + "\"");
}
delete t;
}
//======================================================================
// Support methods
//======================================================================

View File

@ -179,6 +179,8 @@ class TransliteratorTest : public IntlTest {
*/
void TestSTV(void);
void TestCompoundInverse(void);
//======================================================================
// Support methods
//======================================================================